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