How to replace values less than zero in a cell array with NaN?

7 ビュー (過去 30 日間)
Iknoor Singh
Iknoor Singh 2013 年 2 月 22 日
I have a huge cell array and there is a column with a lot of negative values. I want to clean up and replace all those values with NaN. Would appreciate any help. Thanks.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 22 日
編集済み: Azzi Abdelmalek 2013 年 2 月 22 日
% for all columns
B=cell2mat(A)
B(B<0)=nan
A=num2cell(B)
%if column 2 for e.g
B=cell2mat(A)
B(B(:,2)<0,2)=nan
A=num2cell(B)
  1 件のコメント
Iknoor Singh
Iknoor Singh 2013 年 2 月 22 日
Thanks Azzi, that helped a lot.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by