Data Analysis with uneven data lenghts

Hi
I have two sets of data that are different lenghts which has caused a problem where the shorter set of data has now presumed that the rest of the data is all 0 so the graph has a sharp line that shouldn't be there. Is there a way of stopping this problem?
Data1 = csvread('Swale5km.csv')
Data1(:,1), Data1(:,2), Data1(:,3), Data1(:,4)
plot(Data1(:,1), Data1(:,2),Data1(:,3), Data1(:,4))
xlabel 'Time/Hours'
ylabel ' Concentration ug/l'

1 件のコメント

Peter Perkins
Peter Perkins 2020 年 11 月 20 日
Data1(:,1), Data1(:,2), Data1(:,3), Data1(:,4) as written above certainly are not different lengths.
If you have x1, y1 different lengths than x2, y2, plot(x1,y1,x2,y2) will work just fine.

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

 採用された回答

dpb
dpb 2020 年 10 月 27 日
編集済み: dpb 2020 年 10 月 27 日

0 投票

Substitute NaN for the missing values; plot() will silently ignore it.
Since it appears there are no real zero values, you can do it trivially in this case:
Data1(Data1==0)=nan;

1 件のコメント

Matthew Gilroy
Matthew Gilroy 2020 年 10 月 27 日
Cheers that was really helpful

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLanguage Fundamentals についてさらに検索

質問済み:

2020 年 10 月 27 日

コメント済み:

2020 年 11 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by