plotting data from data files and saving each plot through out each run of the loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Thuso Gaosenngwe
el 12 de Sept. de 2019
Comentada: Thuso Gaosenngwe
el 19 de Sept. de 2019
hello guys im trying to plot data from different dat files that have different parameters C (used to identity the file) throghout each run of the loop. For some reason im only getting one plot. Please help
below is what i did.
******************************************************************************************
Cpara=[0.02, 0.03, 0.04, 0.05, 0.06, 0.015, 0.025, 0.035, 0.045, 0.055];
for k = Cpara
file = importdata(strcat('A=0.12_B=2_C=',mat2str(k),'_hnull_2.1_t0.01e.dat'));
plot(file(:,1),file(:,2))
end
0 comentarios
Respuesta aceptada
David K.
el 12 de Sept. de 2019
If you wish to have all the plots on the same figure, you need to use
figure;
hold on
%The rest of your code
If you wish to have multiple figures you need to do
for k = Cpara
file = importdata(strcat('A=0.12_B=2_C=',mat2str(k),'_hnull_2.1_t0.01e.dat'));
figure
plot(file(:,1),file(:,2))
end
What you were doing was just replacing each plot with the next one instead of creating new figures.
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!