Aaron's Octave Assignment

From Class Wiki
Jump to navigation Jump to search

Just like C++ Octave and Matlab recognize if statements.

if (%your condition%)
%your command%;
else
%your command%;
end

More complex systems can use the elseif command

if (%condition%)
elseif (%condition%)
 %commands%;
elseif(%condition%)
 %commands%;
else(%condition%)
  %commands%;
end

for instance

if (a=b)
  t = -1;
elseif (a>b)
  t = -2;
else
  t = 0;
end