Setting min and max values of an array

4 ビュー (過去 30 日間)
Y.U
Y.U 2017 年 3 月 7 日
コメント済み: Justin Keister 2021 年 5 月 19 日
Hi,
I have the following array A=(1:5:500).
If the value in the array is less than max(A)/2 I need the value to be set to max(A)/2. After that I need it to continue to the final value of the array.
Can anyone suggest a solution?

採用された回答

KSSV
KSSV 2017 年 3 月 7 日
A = rand(1,500) ;
id = find(A<max(A)/2) ;
A(id(1):end) = max(A)/2 ;
  1 件のコメント
Justin Keister
Justin Keister 2021 年 5 月 19 日
It should be A(id(1:end)) = max(A)/2;

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by