Removing NaN in all the columns from matrix A to produce matrix B

1 次查看(过去 30 天)
I have matrix A
A = [1 NaN 55 NaN 14 NaN 1 NaN 1 NaN 1
2 NaN 55 NaN 14 NaN 1 NaN 1 NaN 1
3 NaN 55 NaN 14 NaN 1 NaN 1 NaN 1
4 NaN 35 NaN 14 NaN 1 NaN 1 NaN 1];
Remove all the NaN
B = [1 55 14 1 1 1
2 55 14 1 1 1
3 55 14 1 1 1
4 35 14 1 1 1];

采纳的回答

Fangjun Jiang
Fangjun Jiang 2020-5-28
编辑:Fangjun Jiang 2020-5-28
index=any(isnan(A));
B=A(:,~index)

更多回答(0 个)

类别

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