How Execute statements if else condition

7 ビュー (過去 30 日間)
houssem chedli
houssem chedli 2017 年 12 月 13 日
編集済み: per isakson 2017 年 12 月 14 日
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 件のコメント
Walter Roberson
Walter Roberson 2017 年 12 月 13 日
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:
  1. input file name
  2. title for the plot
  3. ylabel to use for the plot
  4. 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.
houssem chedli
houssem chedli 2017 年 12 月 13 日
yes it will be Praktikal but how can I do that in my Excelfile are the Columns labeled (in the First row) but how can i Prepare a single file? what do you mean ?

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by