Effacer les filtres
Effacer les filtres

multiple plot for 3-dimensional array

2 vues (au cours des 30 derniers jours)
Hassan
Hassan le 24 Avr 2011
I have a array A(16 rows,5 columns,32 bands) and a vecotr B(1 row, 32 columns). I want to make 16*5=80 plots as the first plot is A(1,1,:) against B, second plot is A(1,2,:) against B,...,A(16,5) against B. it seems plot() function works for 2-dimensional data. I tried the following code but an error message come up that 'Data may not have more than 2 dimensions'. Any help is apperciated.
y=B
fignum = 1;
for i=1:16
for j=1:5
while ishandle(fignum)
fignum = fignum + 1;
end
figure(fignum);
x=A(i,j,:);
plot(x,y);
end
end

Réponse acceptée

Oleg Komarov
Oleg Komarov le 24 Avr 2011
Use squeeze:
A = rand(16,5,32);
B = rand(1,32);
plot(squeeze(A(1,1,:)),B)
  1 commentaire
Hassan
Hassan le 24 Avr 2011
thanks a lot Oleg.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by