replacing a row of an existing table with nans
8 ビュー (過去 30 日間)
古いコメントを表示
if t is a table with a mix of numeric columns and text columns, how can i replace a specific row (let us say row 20 of t) with nan values? I tried
t(20,:)=nan;
t{20,:)=nan;
but both failed.
0 件のコメント
回答 (2 件)
Walter Roberson
2017 年 11 月 9 日
NaN cannot be stored in the text columns.
Depending upon your needs, it might help to look at https://www.mathworks.com/help/matlab/matlab_prog/clean-messy-and-missing-data-in-tables.html
0 件のコメント
Peter Perkins
2017 年 11 月 16 日
In recent versions of MATLAB, you can do this:
>> t = table([1;2;3],["a";"b";"c"])
t =
3×2 table
Var1 Var2
____ ____
1 "a"
2 "b"
3 "c"
>> t{2,:} = missing
t =
3×2 table
Var1 Var2
____ _________
1 "a"
NaN <missing>
3 "c"
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!