How to remove certain value from array and reshape the array?

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.
Any ideas?

回答 (1 件)

Guillaume
Guillaume 2017 年 12 月 1 日
編集済み: Guillaume 2017 年 12 月 1 日

2 投票

Deleting arbitrary elements from an array will always automatically reshape it into a vector unless you explicitly delete entire rows, columns, pages, etc.
So:
S(S == -120) = [];
will delete all -120 values and reshape your array at the same time.

3 件のコメント

minsoo kim
minsoo kim 2017 年 12 月 2 日
thx!
Mohammad Safayet Hossain
Mohammad Safayet Hossain 2018 年 11 月 24 日
Thanks a lot...It works nicely....
Muhammad Danish
Muhammad Danish 2022 年 10 月 27 日
its not working bro

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange연산자와 기초 연산 についてさらに検索

質問済み:

2017 年 12 月 1 日

コメント済み:

2022 年 10 月 27 日

Community Treasure Hunt

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

Start Hunting!