MATLAB Answers

How to use subplot within two loops

조회 수: 1(최근 30일)
Hinde essmahi BOUZIANE
I need one figure with multiple graphs within two loops.
for i=1:length(state)
[block]
for j=1:length(channel)
[block]
subplot(length(state),length(channel)),j)
plot(a,b)% a and b are arrays of doubles.
end
end
I want one figure with size =length(state)*length(channel); for instance I need all the graphs of state(1)within all channels in the first row etc...
But what I get is multiple figures (the lenght of state).

  댓글 수: 0

로그인 to comment.

답변 수 (1)

KALYAN ACHARJYA
KALYAN ACHARJYA 8 Aug 2019
KALYAN ACHARJYA 님이 편집함. 8 Aug 2019
Extra parenthesis here ...
subplot(length(state),length(channel)),j)
%....................................^
Try
l=1;
for....
for..
.....
subplot(length(state),length(channel),l)
plot(a,b) % a and b are arrays of doubles.
l=l+1;
end
end

  댓글 수: 1

madhan ravi
madhan ravi 8 Aug 2019
You mean parenthesis.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by