How to put NaN in certain row of particular column according to another column having NaN in some row

1 回表示 (過去 30 日間)
here in 10th column(u_py) some row is NaN , I have to put NaN in same row of 5th column (Pyrn2_Avg).
  2 件のコメント
Rik
Rik 2023 年 3 月 15 日
Seems like a simple for loop would do. What have you tried?
Ritesh
Ritesh 2023 年 3 月 15 日
@Rik I am new in matlab, and i have used this one
data.Pyrn2_Avg(~isnan(data.Pyrn2_Avg)) = data.u_py(~isnan(data.Pyrn2_Avg));
but it replaces all value of 10th column in 5th column.
please sugest me code for this.

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

採用された回答

VBBV
VBBV 2023 年 3 月 15 日
data.Pyrn2_Avg(isnan(data.u_py)) = NaN; % assign NaN to this line

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by