How to replace value if it is multiple of other Value

Hello, I have the following value
Maximumvalue=45
Minimumvalue=15
I want apply a if else condition if the Maximumvalue if multiple of Minimumvalue then Maximumvalue should be replace with Minimum Value,
How can i do it in matlab

 Respuesta aceptada

A = [3 4 5 9]
A = 1×4
3 4 5 9
[A0,idx0] = min(A) ;
[A1,idx1] = max(A) ;
if ~mod(A1,A0)
A(idx1) = A0 ;
end
A
A = 1×4
3 4 5 3

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Productos

Versión

R2022a

Preguntada:

el 16 de Dic. de 2022

Respondida:

el 16 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by