Filter löschen
Filter löschen

how can I save the all graphs with different names at the same time?

2 Ansichten (letzte 30 Tage)
Heramb Gaikwad
Heramb Gaikwad am 15 Sep. 2015
Bearbeitet: Stephen23 am 15 Sep. 2015
I have excel file I want to plot the various column data against time column, then my question is how can I save the all graphs with different names at the same time?

Antworten (2)

yogesh jain
yogesh jain am 15 Sep. 2015
Try with using of 'for' looping . every iteration of graph creation may give that different name .
  2 Kommentare
Heramb Gaikwad
Heramb Gaikwad am 15 Sep. 2015
I tried for loop but it is not working. so can you please explain me in brief?
Heramb Gaikwad
Heramb Gaikwad am 15 Sep. 2015
also I tried with while loop. But does not work.

Melden Sie sich an, um zu kommentieren.


Stephen23
Stephen23 am 15 Sep. 2015
Bearbeitet: Stephen23 am 15 Sep. 2015
Make a loop that loops over each figure, and save each figure. You can generate the filenames (or other info) during each loop.
This is covered very well in many posts in this forum, and also in the MATLAB wiki, including example code:
  2 Kommentare
Heramb Gaikwad
Heramb Gaikwad am 15 Sep. 2015
Bearbeitet: Stephen23 am 15 Sep. 2015
Dear Sir, Actually my problem is I have excel file. I have read this file by following program:
[inFileName,inPathName] = uigetfile('*.xls','Select the xls-file');
a=xlsread(inFileName);
b=a(2:1394,:);
c=b(:,7);
j=16;
while j<=33
d=b(:,j);
dd=smooth(d);
a1=plot(c,dd);
xlabel('time (min)'); % x-axis label
ylabel('velocity (m/s)'); % y-axis label
title('Graph of velocity Vs Time');
legend('zonal velocity m/s');
j=j+1;
end
Now, after one time execution of program one file is created; that file at the same time I want to save. then next time it will execute then second graph is created; that graph I want save with again different name and so on till the condition is not satisfied.
Stephen23
Stephen23 am 15 Sep. 2015
Bearbeitet: Stephen23 am 15 Sep. 2015
You can use print to save a figure, like this:
[inFileName,inPathName] = uigetfile('*.xls','Select the xls-file');
a = xlsread(inFileName);
b = a(2:1394,:);
c = b(:,7);
for k = 16:33
d = b(:,k);
dd = smooth(d);
a1 = plot(c,dd);
xlabel('time (min)');
ylabel('velocity (m/s)');
title('Graph of velocity Vs Time');
legend('zonal velocity m/s');
print(sprintf('ImageFileName_%d',k),'.png');
end
Read the print documentation for lists of the supported image formats, and other useful options.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by