Graphics Programs Reference
In-Depth Information
dbstep Executes an M-file line-by-line after stopping at a breakpoint.
dbstop Insert a breakpoint in a file.
dbstop in <filename> at <linenumber>
dos Runs a command from the operating system, saving the result in a variable.
Similar to unix .
end Terminates an if , for , while ,or switch statement.
else Alternative in a conditional statement. See if .
elseif Nested alternative in a conditional statement. See the online help for if .
error Displays an error message and aborts execution of an M-file.
find Reports indices of nonzero elements of an array.
n = find(isspace(mystring));
if ˜isempty(n)
firstword = mystring(1:n(1)-1);
restofstring = mystring(n(1)+1:end);
end
for Repeats a block of commands a specified number of times. Must be terminated
by end .
close; axes; hold on
t = -1:0.05:1;
for k = 0:10
plot(t, t.ˆk)
end
function Used on the first line of an M-file to make it a function M-file.
function y = myfunction(x)
if AllowsconditionalexecutionofMATLABstatements.Mustbeterminatedby end .
if (x >= 0)
sqrt(x)
else
error('Invalid input.')
end
input Prompts for user input.
answer = input('Please enter [x, y] coordinates: ')
isa Checks whether an object is of a given class ( double , sym , etc.).
isa(x, 'sym')
ischar True if an array is a character string.
Search WWH ::




Custom Search