Removing NAN values from the table and deleting it.
45 次查看(过去 30 天)
显示 更早的评论
Hi
I have a table which is arrranged in susch a waym that it has one row of data and other row which contain NAN and so on, I want to get rid of NAN and aferwards deleting it.
Could you help me with this.
0 个评论
采纳的回答
madhan ravi
2018-11-17
编辑:madhan ravi
2018-11-17
rmmissing(T) %deletes row containing nan where T your table
16 个评论
madhan ravi
2018-11-19
Thank you sir Walter , have to familiarise with any and all it‘s slightly confusing :)
更多回答(2 个)
Francesco
2025-2-12
编辑:Francesco
2025-2-12
Following another question I found this code working really good:
Xnew=X((isfinite(X)));
The new array has no Nan inside.
5 个评论
Francesco
2025-2-12
编辑:Francesco
2025-2-12
Yes the principle is the same, if you have a table, for example in your case, you can call the columns using T.Column_name, in this case:
T = array2table([1,2,3;nan,2,3;1,2,3;1,2,3;nan,2,3])
X=T.Var1 ; Y=T.Var2; Z=T.Var3;
Xnew=X((isfinite(X)));
Ynew=Y((isfinite(X)));
Znew=Z((isfinite(X)));
T_new = array2table([Xnew,Ynew,Znew])
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!