how to add nan values to existing array?

조회 수: 9 (최근 30일)
Suresh R
Suresh R 2021년 11월 3일
댓글: the cyclist 2021년 11월 3일
how to add nan values to existing array? i have 1X5 array.i want to change size to 10x5.
  댓글 수: 2
Johan
Johan 2021년 11월 3일
You can try this
A = rand(1,5)
A = 1×5
0.5817 0.9565 0.1770 0.5972 0.9275
A = [A;NaN*(ones(9,5))]
A = 10×5
0.5817 0.9565 0.1770 0.5972 0.9275 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
the cyclist
the cyclist 2021년 11월 3일
You can do
nan(9,5)
rather than
NaN*(ones(9,5))

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by