Extracting subplots from a matrix

조회 수: 16 (최근 30일)
jeanne93
jeanne93 2021년 2월 2일
댓글: jeanne93 2021년 2월 2일
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!

채택된 답변

Stephan
Stephan 2021년 2월 2일
편집: Stephan 2021년 2월 2일
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
jeanne93
jeanne93 2021년 2월 2일
Wonderful, thank you so much!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Teaching Resources에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by