how can i insert in plot different values
조회 수: 1 (최근 30일)
이전 댓글 표시
how can i make a code that repeats the plot command and for each different iteration has different results
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/630225/image.png)
fu*nction [Y] = PlotProduct(X,Names)
for N = 1: 5;
figure;
plot(X);
title(Names{N});
xlabel('PRICES');
end
댓글 수: 0
채택된 답변
Sulaymon Eshkabilov
2021년 5월 25일
Hi,
Here is a simple solution:
Names={'One', 'Two', 'Three', 'Four', 'Five'};
X = randi([0, 13], 5, 15);
for N = 1: 5
figure(N)
PlotProduct(X(N, :), Names{N})
end
function [Y] = PlotProduct(X,Names)
plot(X);
title(Names);
xlabel('PRICES');
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!