필터 지우기
필터 지우기

How to split columns up into different numbers of figures?

조회 수: 2 (최근 30일)
Mary292
Mary292 2015년 1월 13일
댓글: Image Analyst 2015년 3월 7일
If I have a matrix of data, X, which has 30 columns. Is there some way of using an if statement or something similar to divide the columns up to produce 5 figures. E.g. the first figure would contain columns 1-3 and the the second figure would contain columns 4-6 etc.
  댓글 수: 2
Nicholas
Nicholas 2015년 1월 13일
Hi marie - you could use a 'if' inside a 'for' loop for this.
Image Analyst
Image Analyst 2015년 3월 7일
Original question in case Mary overwrites if with gibberish like her other questions:
If I have a matrix of data, X, which has 30 columns. Is there some way of using an if statement or something similar to divide the columns up to produce 5 figures. E.g. the first figure would contain columns 1-3 and the the second figure would contain columns 4-6 etc.

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

채택된 답변

Sara
Sara 2015년 1월 13일
% This values are here just to show an example
n = 7; % num
A = zeros(10,n);
for i = 1:n
A(:,i) = i;
end
ncols = 3; % columns per plot
niter = ceil(n/ncols);
for i = 1:niter
figure
kstart = (i-1) * ncols + 1;
kend = min(kstart + ncols-1 ,n);
for j = kstart:kend
plot(A(:,j)),hold on
end
ylim([0 10])
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by