필터 지우기
필터 지우기

Replacing zeros with empty values?

조회 수: 52 (최근 30일)
Mark
Mark 2012년 6월 21일
Is it possible for matrices in matlab to replace zeros by empty values i.e. not even give a zero but have blank entries?

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 6월 21일
No. Not unless every row/column has one and you concatenate.
It is possible to have empty elements in cell arrays though, consider:
A = magic(5); %sample
A(A<10)=0; %some zeros
C = cellfun(@(x)x(logical(x)),num2cell(A),'uni',false) %cell with empties where zeros were
  댓글 수: 1
Mark
Mark 2012년 6월 21일
Excellent, I didn't think so, and you're alternative is fantastic! Thank you!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by