If statement with an greater than comparison

103 次查看(过去 30 天)
Hi,
I am trying to write an "if" statement between 2 values. I have a value "A" and a value "B". I want to set C to the value of A or B that is larger.
So like if A>B then C=A, otherwise C=B.
I am having trouble getting the proper code for this in matlab though.
Thanks

采纳的回答

Guillaume
Guillaume 2014-10-6
It's pretty much what you've written:
if A > B
C = A;
else
C = B;
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by