plot using for loop?
조회 수: 1 (최근 30일)
이전 댓글 표시
hi all, I have the following code to plot 5 different subplot hist. for 5 different matrices but it has the same dim. for each
x=-0.09 : 0.01 : 0.9;
hist(Y,x)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','k','EdgeColor','w')
axis([-0.12 0.12 0 200])
I want to use for loop to plot it (i.e. Y is the changed matrix that mentioned above) can anyone help me to do it? thank you in advance.
댓글 수: 2
채택된 답변
Massimo Zanetti
2016년 9월 28일
편집: Massimo Zanetti
2016년 9월 28일
Assume your five matrices are Y1,Y2,Y3,Y4,Y5. Then, put them in a cell and then run a for loop:
Y = {Y1,Y2,Y3,Y4,Y5};
x=-0.09 : 0.01 : 0.9;
for k=1:5
figure;
hist(Y{k},x);
h = findobj(gca,'Type','patch');
set(h,'FaceColor','k','EdgeColor','w');
axis([-0.12 0.12 0 200]);
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!