How Execute statements if else condition

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 Comments

Is the information 'I Max(A)' or 'U Max(v)' somewhere in the Excel file? And the information 'Current Harmonic' or 'Voltage Harmonic L1' ?
no she isn't but i can Write it for each file i must do 10 Different plot ,i Can't put all the Code her because he is very Lang and each Plot have different Legend and a different Title did you have a Solution ? Thank you
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.
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 ?

Sign in to comment.

Answers (0)

Asked:

on 13 Dec 2017

Edited:

on 14 Dec 2017

Community Treasure Hunt

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

Start Hunting!