Create a new array on the basis of another array

5 ビュー (過去 30 日間)
luca
luca 2019 年 10 月 14 日
回答済み: Shubham Gupta 2019 年 10 月 14 日
Hi given an array
V = [78 60 64 30 78 70 50 64 80 68 74 52 62 54 30]
I want to find minum inside V and put 100 in the place of the minimum. (In this case 30). If the minimum is contain x times, I want to put 100 in all of these x places. Then in all the other places I want to put 100 minus the value in V for each column. obtaining:
A = [22 40 36 100 22 30 50 36 20 32 26 48 38 46 100].
Could someone help with this code?

採用された回答

Shubham Gupta
Shubham Gupta 2019 年 10 月 14 日
Try:
A = 100-V;
A(A == max(A)) = 100;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by