Setting min and max values of an array

4 Ansichten (letzte 30 Tage)
Y.U
Y.U am 7 Mär. 2017
Kommentiert: Justin Keister am 19 Mai 2021
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?

Akzeptierte Antwort

KSSV
KSSV am 7 Mär. 2017
A = rand(1,500) ;
id = find(A<max(A)/2) ;
A(id(1):end) = max(A)/2 ;

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by