Graphics Programs Reference
In-Depth Information
You can also use semicolons to separate a string of commands when you are
interested only in the output of the final command (several examples appear
later in the chapter). Commas can also be used to separate commands without
suppressing output. If you use a semicolon after a graphics command, it will
not suppress the graphic.
The most common use of the semicolon is to suppress the printing of
a long vector, as indicated in Chapter 2.
Another object that you may want to suppress is MATLAB's label for the
output of a command. The command disp is designed to achieve that; typing
disp(x) will print the value of the variable x without printing the label and
the equal sign. So,
>>x=7;
>> disp(x)
7
or
>> disp(solve('x + tan(y) = 5', 'y'))
-atan(x-5)
Data Classes
Every variable you define in MATLAB, as well as every input to, and output
from, a command, is an array of data belonging to a particular class .Inthis
topic we use primarily four types of data: floating point numbers, symbolic
expressions, character strings, and inline functions. We introduced each of
these types in Chapter 2. In Table 4-1, we list for each type of data its class
(as given by whos ) and how you can create it.
Type of data
Class
Created by
Floating point
double
typing a number
Symbolic
sym
using sym or syms
Character string
char
typing a string inside single quotes
Inline function
inline
using inline
Table4-1
Youcanthinkofanarrayasatwo-dimensionalgridofdata.Asinglenumber
(or symbolic expression, or inline function) is regarded by MATLAB as a 1 × 1
Search WWH ::




Custom Search