remove NaN from 1xn Matrix

1 view (last 30 days)
Takim Mustakim
Takim Mustakim on 10 Nov 2022
Edited: Arif Hoq on 10 Nov 2022
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

Accepted Answer

Arif Hoq
Arif Hoq on 10 Nov 2022
Edited: Arif Hoq on 10 Nov 2022
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

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!