Matlab Question and answers

xplain the MATLAB commands?

These is the basic MATLAB Interview Questions which is asked in an interview. Below is the MATLAB commands are as follows:

Session Management Commands

  • help Searches for a help topic.
  • whos Lists current variables (long display).
  • who Lists current variables.
  • quit Stops MATLAB.
  • global Declares variables to be global.
  • clear Removes variables from memory.
  • clc Clears command window.
  • look for Searches help entries for a keyword.
  • exist Checks for the existence of a file or variable.

A command for the Systems

  • path Displays search path.
  • pwd Displays the current directory.
  • delete Deletes a file.
  • diary Switches on/off diary file recording.
  • dir Lists all files in the current directory.
  • cd Changes current directory.
  • date Displays the current date.
  • delete Deletes a file.
  • type Displays contents of a file.
  • what Lists all MATLAB files in the current directory.
  • wklread Reads .wk1 spreadsheet file.

Commands for Input and Output

  • format Controls screen-display format.
  • fprintf Performs formatted writes to screen or file.
  • input Displays prompts and waits for input.
  • disp Displays contents of an array or string.
  • fscanf Read formatted data from a file.

Plotting Commands

  • axes Creates axes objects.
  • close Closes the current plot.
  • close all Closes all plots.
  • polar Creates polar plot.
  • semilogx Creates semilog plot. (logarithmic abscissa).
  • semilogy Creates semilog plot. (logarithmic ordinate).
  • stairs Create stairs plot.
  • stem Creates stem plot.
  • axis Sets axis limits.
  • fplot Intelligent plotting of functions.
  • grid Displays gridlines.
  • plot Generates xy plot.
  • print Prints plot or saves the plot to a file.
  • title Puts text at top of the plot.
  • xlabel Adds text label to the x-axis.
  • ylabel Adds text label to the y-axis.
  • refresh Redraws current figure window.
  • set Specifies properties of objects such as axes.
  • subplot Creates plots in subwindows.
  • text Places string in a figure.
  • bar Creates bar chart.
  • log-log Creates log-log plot.

Array, Matrix, and Vector Commands

  • reshape Changes size.
  • size Computes array size.
  • sort Sorts each column.
  • sum Sums in each column.
  • eye Creates an identity matrix.
  • ones Create an array of ones.
  • zeros Create an array of zeros.
  • cat Concatenates arrays.
  • find Finds indices of nonzero elements.
  • length Computes a number of elements.
  • linspace Creates regularly spaced vector.
  • logspace Creates logarithmically spaced vector.
  • max Returns largest element.
  • min Returns the smallest element.
  • prod Product of each column.

Leave a Reply

Your email address will not be published. Required fields are marked *