How do I make a function to plot a given number of graphs(from a user input) from 30 columns of data?
조회 수: 2 (최근 30일)
이전 댓글 표시
So I have a matrix L, which has 30 columns of data. I want to make a function which will be something like composite_plot_tsd(L,y). Where y is the number of graphs I want the 30 columns of data to be plotted on. So far I have this:
function [y] = composite_plot_tsd(L,y)
n=30;
ncols = ceil(30/y); % columns per plot
for i = 1:y
figure
kstart = (i-1) * ncols+1;
kend = min(kstart + ncols-1 ,n);
for j = kstart:kend
plot(L(:,j)),hold on
end
end
So for example if I used the function composite_plot_tsd(L,9), it would plot the 30 columns of data onto 9 separate figures. However the problem with my code is that with a number that isn't divisible by 30 it only plots onto 8 figures. I was hoping someone could help me correct my code and guide me in the right direction.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!