Replacing whole row with NaN's if first value is equal to 13 or 15.
1 view (last 30 days)
Show older comments
Hi! I have a matrix in which I want to replace the whole row with NaNs if the value of the first row is equal to 13 of 15. Can anyone help me with this?
0 Comments
Accepted Answer
Voss
on 19 Jun 2022
Do you mean the value of the first column is equal to 13 or 15?
A = randi(20,10,5)
idx = A(:,1) == 13 | A(:,1) == 15;
A(idx,:) = NaN
Or do you mean replace the whole column if the value of the first row is 13 or 15?
A = randi(20,10,5)
idx = A(1,:) == 13 | A(1,:) == 15;
A(:,idx) = NaN
More Answers (0)
See Also
Categories
Find more on NaNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!