How to save multiple Matlab figures in separate folders?

2 views (last 30 days)
Hi,
I want to save each of multiple figures in separate folders.. What is the command that I can use?
For example: file1.fig will be saved in A folder, file2.fig will be saved in B folder.
How can I do this?
Thanks a lot..

Answers (1)

Fangjun Jiang
Fangjun Jiang on 4 Apr 2018
Edited: Fangjun Jiang on 4 Apr 2018
use fullfile() to specify the full path of the file and saveas().
  3 Comments
Fangjun Jiang
Fangjun Jiang on 4 Apr 2018
Fig=plot(rand(1,10));
File=fullfile('c:\MyDirectory','FolderA','MyFigure.fig');
saveas(Fig,File,'fig');
nancy
nancy on 13 Apr 2018
Thank you very much..
How can I add this code to my Matlab code?
Because; I study on double Y-axis as you can see below. I mean that what can I write instead of "File" ?
figure;[haxes,hline1,hline2] = plotyy(dat_s,M1K1_norm,dat_s,T); set(haxes(1),'XLim',[0 DATA],'LineWidth',1.5); set(haxes(2),'XLim',[0 DATA]); set(haxes(1),'YLim',[0 1.3], 'FontSize', 16); set(haxes(1),'YTick',[0:0.13:1.3]); set(haxes(2),'YLim',[-60 90], 'FontSize', 16); set(haxes(2),'YTick',[-60:15:90]) set(hline1,'Color','r','LineWidth',3); set(hline2,'Color','y','LineWidth',3); set(haxes, 'FontSize',15,'LineWidth',2)
hold on;
[haxes,hline1,hline2] = plotyy(dat_s,M1K2_norm,dat_s,T); set(haxes(1),'XLim',[0 DATA]); set(haxes(2),'XLim',[0 DATA]); set(haxes(1),'YLim',[0 1.3], 'FontSize', 16); set(haxes(1),'YTick',[0:0.13:1.3],'Ycolor', 'k'); set(haxes(2),'YLim',[-60 90], 'FontSize', 16); set(haxes(2),'YTick',[-60:15:90], 'Ycolor', 'k'); set(hline1,'Color','b','LineWidth',3); set(hline2,'Color','k','LineWidth',3); ylabel('Normalize Güç'); ylabel(haxes(2),'Sicaklik (C)'); title('test');xlabel('A'); set(haxes, 'FontSize',15,'LineWidth',2) legend('test'); grid

Sign in to comment.

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!