필터 지우기
필터 지우기

How to replace value if it is multiple of other Value

조회 수: 2 (최근 30일)
Med Future
Med Future 2022년 12월 16일
답변: KSSV 2022년 12월 16일
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