Add NaN in the first row of a table

조회 수: 5 (최근 30일)
Indrani
Indrani 2024년 9월 19일
댓글: Indrani 2024년 9월 19일
I have a table (size 449801x1). I want to add NaN in the first row of the table. How do I do this?

답변 (1개)

Aquatris
Aquatris 2024년 9월 19일
Assuming all your entries are numeric, since you want to assign NaN, here is one way;
% create dummy table
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
T = table(Age,Height,Weight);
T
T = 5x3 table
Age Height Weight ___ ______ ______ 38 71 176 43 69 163 38 64 131 40 67 133 49 64 119
% assign NaN to 1st row
T(1,:) = array2table(NaN(size(T(1,:))));
T
T = 5x3 table
Age Height Weight ___ ______ ______ NaN NaN NaN 43 69 163 38 64 131 40 67 133 49 64 119

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by