Friday, November 25, 2005

 

Plotting in Matlab without X-window

Matlab can be operated in non-GUI mode. To start matlab:
matlab -nodesktop -nojvm -nosplash
If you wish to plot graphs without using X or GUI, open a figure with visibility hidden, plot the graph and then print the figure to a file.
>> h = figure('Visible', 'off')
h =

     1
figure returns a handle to figure. Now issue the plot command.
plot(1:4,5:8)
The figure can now be saved using the print command.
print -f1 -dps 'filename.ps'
The syntax for the print command is
print -fhandle -ddevice.
In our case, the handle is 1 and device is post script file.

Update: As posted by anonymous, another option is to use
saveas(h,'file.png');

Monday, November 07, 2005

 

New Blog

I now have this space where, hopefully, I will be writing something.

This page is powered by Blogger. Isn't yours?