Plot by loading a vector, saved from a different workspace as .mat file(converting struct to vector)
Ältere Kommentare anzeigen
Hi,
im quite new to Matlab so sorry for the completely amateur question, but I need help.
I have alot of calculations done inside a loop where i change a value and get two vectors(Concentration and Height) that i use to plot.
My objective is to change the value of X from which the two vectors are calulated, from 0,5,10,15,20. And then plot for Concentration and Height corresponding to each of these values.
I though of manually go, and change the value -> run the code->save variable as a .mat file.
Make a new code and define them as a new variable with the load command.
And then make a plot from each of these loaded vectors. But when i load them, the are converted into a 1x1 struct and i get a "Error using plot Invalid data argument".
My question is.
Is there any other way to plot it or can i somehow convert the loaded file from a struct to a vector that i define?
I attached the variables.mat files and this is the code.
Best Regards
Saad Khan
%Code for loading the variables, OBS! Make sure .mat files are in same
%folder as this file!!!
%Loading of variables%
He10=load('He_10.mat');
c10=load('c_10.mat');
He15=load('He_15.mat');
c15=load('c_15.mat');
He20=load('He_20.mat');
c20=load('c_20.mat');
%plot
figure(1)
plot(He10,c10(1:length(He10),1),'-r',He15,c15(1:length(He15),1),'-g',He20,c20(1:length(He20),1),'-b');
xlabel('Height[m]')
ylabel('CO Concentration[vol%]')
legend('O2=10%','O2=15%','O2=20%')
title('CO optimal at different O2 concentrations')
saveas(figure(1),'combo.png')
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Structures finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
