How to delete nan from array

408 次查看(过去 30 天)
B=[nan 8 nan;6 nan nan;6 5 8] C=[nan 4 nan;4 nan nan;5 3 2]
Answer: B=[8 6 6 5 8] C=[4 4 5 3 2]

采纳的回答

Guillaume
Guillaume 2015-1-13
编辑:Guillaume 2015-1-13
B = B';
B = B(~isnan(B))';
C = C';
C = C(~isnan(C))';
  3 个评论
Guillaume
Guillaume 2015-1-13
Yes, not sure what I was thinking.
Yang Liu
Yang Liu 2022-8-4
Why use '? Why not just B=B(~isnan(B))?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by