Don't show "NaN" in uitable ,if there not value in a table cell.

 採用された回答

Ankit
Ankit 2022 年 9 月 9 日

0 投票

Below method will remove NaN with a variable as ' '. But for this you need to convert your array it into cell array first
A = [1 2 NaN 3 4 NaN 5] ;
Acell = num2cell(A);
idx = cellfun(@(C) all(isnan(C)), Acell);
Acell(idx) = {' '};

その他の回答 (1 件)

KSSV
KSSV 2022 年 9 月 7 日
You can remove the NaN's using isnan.
A = [1 2 NaN 3 4 NaN 5] ;
A(isnan(A)) = []
A = 1×5
1 2 3 4 5

1 件のコメント

CoderMinga
CoderMinga 2022 年 9 月 9 日
The method you described can only delete the NaN ,but I want use a space to instead of NaN

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

カテゴリ

タグ

質問済み:

2022 年 9 月 7 日

コメント済み:

2022 年 9 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by