How to normalize size of smaller arrays to match bigger array for analysis, and remove NaNs?

2 ビュー (過去 30 日間)
So I have an excel file (attached) that has different trials, all having different column sizes. I want to plot the average of these trials by agent (dex, propofol and alfax), so I should get three different lines for three different averages on the same plot. On the plot I want to display time on the x-axis (excel file: test_analyzingtimeHR.xlsx) and on the y-axis, i want to show the average HR (test_analyzingHR.xlsx).
However, this is being difficult because all these trials have different column sizes (WITHOUT NaNs). The largest column size without any NaNs is 1779. For this reason, I want to normalize all the trials so that all the trials have the same column size (1779). I also don't want any NaNs to show up in my matrices, as they're disrupting my calculations for averaging. Can anyone tell me how I could do this best?
I've attached my Matlab code in the attachments.

採用された回答

Matt J
Matt J 2019 年 9 月 27 日
編集済み: Matt J 2019 年 9 月 27 日
Removing the NaNs is the wrong approach. Just use 'omitnan' flags where appropriate. For example,
A =
0.5637 0.8022 0.4707
0.9468 0.8322 0.5755
0.3354 0.5464 0.9030
NaN 0.4492 NaN
NaN 0.4970 0.4532
>> mean(A,'omitnan')
ans =
0.6153 0.6254 0.6006

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by