필터 지우기
필터 지우기

Plot multiple data in one plot using for loop

조회 수: 3 (최근 30일)
Hamidreza Esmalifalk
Hamidreza Esmalifalk 2019년 2월 17일
편집: madhan ravi 2019년 2월 17일
I want to plot these 8 time series using for loop but it plots just the last one alone.
for i=1:8
plot(x,y{i},'LineWidth',2);
hold on
end
hold off

채택된 답변

madhan ravi
madhan ravi 2019년 2월 17일
편집: madhan ravi 2019년 2월 17일
If you look the data in each cell closely infact they are all the same so all the plots overlap each other:
plot(x,[y{:}]) % you don't need a loop
  댓글 수: 1
madhan ravi
madhan ravi 2019년 2월 17일
To check if each cell are same:
isequal(y{:}) % if returns one then they are all the same [resulting with just one plot]

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by