Changes

Jump to navigation Jump to search
462 bytes removed ,  13:52, 21 September 2012
Line 77: Line 77:     
==General==
 
==General==
  −
===Using Variable Strings in Octave Commands===
  −
  −
For example, to plot data using a string variable as a legend:
  −
  −
Option 1 (simplest):
  −
legend = "-1;My data;";
  −
plot(x, y, legend);
  −
  −
Option 2 (to insert variables):
  −
plot(x, y, sprintf("-1;%s;", dataName));
  −
  −
Option 3 (not as neat):
  −
legend = 'my legend';
  −
plot_command = ['plot(x,y,\';',legend,';\')'];
  −
eval(plot_command);
  −
  −
These same tricks are useful for reading and writing data files with unique names, etc.
      
===Vectorizing Tricks===
 
===Vectorizing Tricks===
657

edits

Navigation menu