Remove nonsensical data in plot (for loop )

조회 수: 5 (최근 30일)
Sara
Sara 2025년 10월 4일
답변: Walter Roberson 2025년 10월 5일
I am plotting my results from thermodynamic cycle analysis using a for loop. However, some curves have non-sensical data and I would like to remove them. The X-data is fixed, but the loction of where the Y-data become non-sensical varies. Is there a solution to this particular issue?
  댓글 수: 4
Sara
Sara 2025년 10월 4일
For example in the attached ECOPNET_3.png is the intended result. The vertical lines in ECOPNET_2.png is what needs to be removed.
dpb
dpb 2025년 10월 4일
How are the results being generated; why not fix that proceess to not create the discontinuities to begin with?
If nothing else, at least attach .mat files containing the data such that somebody can do something with it; nothing can be done with the images except look at them.

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

답변 (1개)

Walter Roberson
Walter Roberson 2025년 10월 5일
%assume that Data_To_plot is an N x 7 array of data to be plotted
Copy_Data = Data_To_plot;
Copy_Data(~cumprod(Data_To_Plot > 0, 1)) = nan;
plot(x, Copy_Data)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by