How to prevent pcolor from joining gaps in datetime?

3 ビュー (過去 30 日間)
David Velasco
David Velasco 2021 年 8 月 13 日
I am using pcolor to create a contour graph where the x-axis is a datetime vector. Data exists in 6 s increments from 09:00:00 to 09:03:54 and then from 09:30:00 to 09:33:54 only:
09:00:00
09:00:06
09:00:12
...
09:03:42
09:03:48
09:03:54
09:30:00
09:30:06
...
When using pcolor, it joins the last sample of the first time span with the first sample of the second time span. See attached image. How do I make it such that the time gap between 09:03:54 and 09:30:00 is not plotted? I would like for this region to just be blank or transparent or otherwise not visible.

採用された回答

Image Analyst
Image Analyst 2021 年 8 月 13 日
Try setting those values to nan.
Or else use imshow() and set those values to 0 (black).
By the way, did you know that pcolor() does not display the last row and alst column of your data?
  6 件のコメント
David Velasco
David Velasco 2022 年 12 月 22 日
In my case, data were collected every 6 s, so I looked for the gaps in the datetime vector (Date)...
lastSamp = find(diff(Date) > duration('00:00:07'));
...then set the last sample to nan in my Data:
Data(:,lastSamp) = nan;
Maria-Eleni Gidarakou
Maria-Eleni Gidarakou 2023 年 1 月 4 日
Thank you very much, it worked perfectly!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by