remove NaN from 1xn Matrix

2 次查看(过去 30 天)
A = [0 3 2 4 1 NaN 3 2 NaN 2 4 2 1 3 NaN 2 4 2];
How to make matrix B from A but without "NaN" like:
B = [0 3 2 4 1 3 2 2 4 2 1 3 2 4 2]; from A

采纳的回答

Arif Hoq
Arif Hoq 2022-11-10
编辑:Arif Hoq 2022-11-10
A = [0 3 2 4 1 NaN 3 2 NaN 2 4 2 1 3 NaN 2 4 2];
B = A(~isnan(A))
B = 1×15
0 3 2 4 1 3 2 2 4 2 1 3 2 4 2

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by