필터 지우기
필터 지우기

How do I make a function to plot a given number of graphs(from a user input) from 30 columns of data?

조회 수: 1 (최근 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개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by