Effacer les filtres
Effacer les filtres

How can I plot a single graph that is generated from a file that contains various subfiles?

1 vue (au cours des 30 derniers jours)
I want to plot (u vs time) for each i's in a single graph together.The problem is, how can I give separate color, line type for each i's, here is the code which I tried to work upon. thanks
datafiles = dir('datarus*_qsStruc.mat');
for i = 1:length(datafiles)
load(datafiles(ii).name)
u = qsStruc.beta;
time = qsStruc.time;
plot(u,time,'o');

Réponses (1)

Kevin Claytor
Kevin Claytor le 30 Août 2012
datafiles = dir('datarus*_qsStruc.mat');
nfiles = length(datafiles);
% Get plot colors from a colormap
mycolors = lines(nfiles);
for ii = 1:nfiles
load(datafiles(ii).name)
u = qsStruc.beta;
time = qsStruc.time;
% Set the color to the corresponding entry from the colormap
plot(u,time,'o','color',mycolors(ii,:));
Replace "lines" with whatever colormap suits your fancy.
  1 commentaire
Walter Roberson
Walter Roberson le 30 Août 2012
Or, as was suggested in your earlier question, use plt() which is designed to be able to automatically generate combinations of color and markers and line styles in order to distinguish many different lines.

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by