How to normalize size of smaller arrays to match bigger array for analysis, and remove NaNs?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposta accettata
Matt J
il 27 Set 2019
Modificato: Matt J
il 27 Set 2019
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Import from MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!