Remove a column if it starts with NaN
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Could you please help me find a way to remove a entire column of a matrix if it starts with Nan
Thank you for any help!
0 Kommentare
Antworten (3)
Image Analyst
am 27 Aug. 2014
Try this:
A = [1 nan 3 nan;
1 5 6 0;
2 2 3 4;
2 5 6 0;
2 6 7 8;
3 1 2 3;
4 1 2 3]
badColumns = isnan(A(1,:)) % Find cols with nan in top row.
fixedA = A(:,~badColumns) % Get all except the bad columns.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!