필터 지우기
필터 지우기

How to save multiple plots to a single folder?

조회 수: 1 (최근 30일)
Zach Dunagan
Zach Dunagan 2017년 12월 4일
댓글: Zach Dunagan 2017년 12월 10일
Here is the path to the folder.
filepath = 'C://Users//Zach Dunagan//Desktop//Frame//'
This is what I have attempted.
for n = 1:numPanels
A(n) = figure;
% foil plot
subplot(1, 2, 2);
plot(xc(1:numPanels / 2), CpSto(1:numPanels / 2, n), '*b')
hold on;
plot(xc(numPanels / 2:end), CpSto(numPanels / 2:end, n),'o', 'MarkerFaceColor', 'r');
k = f*chord/Uinf;
t_T = tInterval(t)/.5;
theta_p = theta_t(t)*180/pi;
C_Y = CySto(n);
% legend, x and y labels
legend({'bottom surface', 'top surface'}, 'FontSize', 16);
xlabel('chord', 'Fontsize', 20);
ylabel('C_p', 'FontSize',20);
title(['k = ' num2str(k) ' t_T = ' num2str(t_T) ' \theta_p = '...
num2str(theta_p) '\circ C_{\Upsilon} = ' num2str(C_Y)],'Interpreter','tex');
savefig(A(n), filepath, 'compact');
end
If you just show me a small example I should be able to figure it out.
  댓글 수: 2
Stephen23
Stephen23 2017년 12월 4일
"If you just show me a small example I should be able to figure it out."
Any internet search engine can search the MATLAB documentation:
Zach Dunagan
Zach Dunagan 2017년 12월 10일
I figured it out. I didn't use any of those links. I used the following:
saveas(figure(t), fullfile('C://Users//Zach Dunagan//Desktop//Frame//', ['figure' num2str(t) '.jpeg']));

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2017년 12월 4일
Check the below pseudo code:
path = pwd ;
N = 10 ;
for i = 1:N
plot(rand(10,1)) ;
filename = [path, filesep, 'myfigure',num2str(i)] ;
savefig(filename)
end
  댓글 수: 1
Zach Dunagan
Zach Dunagan 2017년 12월 6일
Can you explain to me what path = pwd does? What about path, filesep, myfigure? I saw this code in an example on Mathworks, but not sure what those mean.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by