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

조회 수: 11 (최근 30일)
CoderMinga
CoderMinga 2022년 9월 7일
댓글: CoderMinga 2022년 9월 9일

채택된 답변

Ankit
Ankit 2022년 9월 9일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by