Common problems
If you need save data in files data1.mat data2.mat etc. use eval in a .m file e.g.
for x=1:5
results=x;
operation=['save ','data',num2str(x),' results']
eval(operation)
end
The first time this loop is run, 'save data1 results' is written into the operation string. Then the eval command executes the string. This will save 1 in data1.mat. Next time round the loop 2 is saved in data2.mat etc.
num2str is useful in other contexts too. Labelling a curve on a graph can be done by:
>> gamma = 90.210;
>> labelstring = ['gamma = ',num2str(gamma)];
>> gtext(labelstring)
num2str converts a number into a string and gtext allows you to place the label where you like in the graphics window.
Saving a figure in postscript format can be done using print -deps pic.ps. Entering print on its own will print the current figure to the default printer.