フィルターのクリア

Replacing NaN's in column of a Matrix

1 回表示 (過去 30 日間)
Claire Hollow
Claire Hollow 2020 年 5 月 29 日
編集済み: Stephen23 2020 年 5 月 29 日
Hello! I feel tihs should be rather simply but for some reason I cannot get it to work.
I have a 2922x14 matrix. In random places in the second column there are 'NaN' and I'm trying to change all the 'NaN' to 250. Im trying to do a possible if-else (or anything that should work) statement to change all the NaN in just that second column to 250. Thank you ahead of time for the help!

採用された回答

Stephen23
Stephen23 2020 年 5 月 29 日
Where M is your matrix:
X = isnan(M(:,2));
M(X,2) = 250;
  1 件のコメント
Claire Hollow
Claire Hollow 2020 年 5 月 29 日
編集済み: Stephen23 2020 年 5 月 29 日
Work perfectly, thank you so much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by