How to replace value if it is multiple of other Value

3 次查看(过去 30 天)
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

采纳的回答

KSSV
KSSV 2022-12-16
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by