user2927392
user2927392

Reputation: 251

error printing a figure in matlab in specific format

I am trying to print a plot in matlab in .fig format. I first tried printing using something like print('filename', 'fig') and I got an error that says Multiple inputs that look like file names: 'filename' and 'fig'. Then I tried print('-f1', 'filename', '-djpeg') and this worked. I am not sure why I am unable to print to .fig format. I want to print in such way it is more clear for viewing. Please suggest which option should I be using. I am having different subplots

 h(1) = subplot(plotCount,1,inputsAxis) %[1 2]
 h(2) = subplot(plotCount,1,errorAxis)  %[3 4]
 h(7) = subplot(plotCount,1,OutputAxis) %5

Upvotes: 0

Views: 652

Answers (1)

Anıl Yeşilkaya
Anıl Yeşilkaya

Reputation: 11

You can use, saveas(fig,filename)

For PNG;

saveas(fig,'MyFig.png');

For JPG;

saveas(fig,'MyFig.jpg');

Upvotes: 1

Related Questions