Extracting subplots from a matrix

16 vues (au cours des 30 derniers jours)
jeanne93
jeanne93 le 2 Fév 2021
Commenté : jeanne93 le 2 Fév 2021
Hi!
The data I have is a matrix 16x80, each row is one of the 16th "conditions" (combination of contrasts). Columns correspond to neural activity/traces associated with each condition. I am trying to get 16 subplots from this matrix like below. How can I instruct Matlab to treat each row of this matrix as data for one subplot? Do I have to manually select each row and plot it separately or is there a quicker way, for example using the for loop?
Sorry if it's very basic, I'm a beginner, so would greatly appreciate any help!

Réponse acceptée

Stephan
Stephan le 2 Fév 2021
Modifié(e) : Stephan le 2 Fév 2021
use a loop:
% randomized data to illustrate:
M = randn(16,80);
for k = 1:size(M,1)
subplot(4,4,k)
plot(M(k,:))
end
  1 commentaire
jeanne93
jeanne93 le 2 Fév 2021
Wonderful, thank you so much!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Teaching Resources 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