필터 지우기
필터 지우기

Is it possible to create a numeric array with a mixture of empty cells and numbers?

조회 수: 1 (최근 30일)
Hey. I want to create an array where some cells are empty and some have values.
For example, a 3x3 array :
16 22 NaN
NaN 2 1
9 19 NaN
Is this possible on MATLAB?
  댓글 수: 1
Stephen23
Stephen23 2018년 1월 25일
Note that "empty" and NaN are two totally different concepts in MATLAB, yet your question seems to confuse them. It is not possible to have empty elements in a numeric array, but it is certainly possible to have NaN values.

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

답변 (1개)

James Tursa
James Tursa 2018년 1월 25일
편집: James Tursa 2018년 1월 25일
Well, you can do it directly pretty much as you typed it:
result = [16 22 NaN
NaN 2 1
9 19 NaN];
Note that every "spot" must have a value, even if it is NaN. The dimensions always have to be rectangular.

카테고리

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