How Execute statements if else condition
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello Dears I have a Problem i Want to make Plots with Matlab for many Excel Files. but when i change The Excel File ,I must everytime change The Title , The Labels and Legends Manual can you help me to Programming this think . ich have a Idee but Matlab can not Executed it . can someone help me Please i need that for my Thesis. Thank you
% filename='File1';
omega=xlsread(filename);%Matrix 10078*28
[z,s]=size(omega);
t=1:1:10080;% Time vector
%
if filename=='File1' %everytime i change a File Name but they have a same size
figure(f1)
V1=omega(:,16);
V2=omega(:,17);
V3=omega(:,18);
plot(t,V1,'displayName','L1-N RMS 1/2(1-cyc)Max(V)')
hold on
plot(t,V2,'displayName','L2-N RMS 1/2(1-cyc)Max(V)')
hold on
plot(t,V3,'displayName','L3-N RMS 1/2(1-cyc)Max(V)')
title('Compare the Current Harmonic ')
ylabel('I Max(A)' )
end
%
if filename='File2.xlsx'
V1=omega(:,16);
V2=omega(:,17);
V3=omega(:,18);
plot(t,V1,'displayName','L1-N RMS 1/2(1-cyc)Max(V)')
hold on
plot(t,V2,'displayName','L2-N RMS 1/2(1-cyc)Max(V)')
hold on
plot(t,V3,'displayName','L3-N RMS 1/2(1-cyc)Max(V)')
title('Compare the Voltage Harmonic L1 ')
ylabel('U Max(v)' )
end
4 Kommentare
Walter Roberson
am 13 Dez. 2017
In your input file, are the columns labeled with names such as 'L1-N RMS 1/2(1-cyc)Max(V)' ?
Would it be practical to prepare a single file with a number of fields:
- input file name
- title for the plot
- ylabel to use for the plot
- legend entries for each column of data
? If it would be practical to do that, then we could read the information out of the file and apply it automatically to the plots.
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!