How to replace the zero with NaN in the specific column of cell arrays?
8 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a cell (1*5) with some 0 in the second and third columns in each cell array; I want to know how to replace all these zeros (only in second and third columns, not the first one) with NaN. I attached the cell.
Thank you so much
0 件のコメント
採用された回答
その他の回答 (1 件)
KSSV
2022 年 11 月 5 日
Let A be your m*3 array.
A(A(:,2)==0,2)=NaN ; % repalce second column with NaN's
A(A(:,3)==0,3)=NaN ; % replace third column with NaN's
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!