How to remove certain value from array and reshape the array?
469 views (last 30 days)
Show older comments
minsoo kim on 1 Dec 2017
Commented: Muhammad Danish on 27 Oct 2022
I want to delete every -120 value from S(i x j) and reshape the S without -120.
Only S(X, certain 'Y's) have this -120 value.
Guillaume on 1 Dec 2017
Edited: Guillaume on 1 Dec 2017
Deleting arbitrary elements from an array will always automatically reshape it into a vector unless you explicitly delete entire rows, columns, pages, etc.
S(S == -120) = ;
will delete all -120 values and reshape your array at the same time.
Find more on Resizing and Reshaping Matrices 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!