Wondering how to use the min/max function in an array?
Mostrar comentarios más antiguos
a = input('What is a?','s');
b = input('What is b?','s');
c = input('What is c?','s');
d = input('What is d?','s');
Lengths = [ a b c d ];
S = min(Lengths)
L = max(Lengths)
PQ = sum(Lengths) - (S + L)
if S + L < PQ
Condition = 'Grashof'
elseif S + L == PQ
Condition = 'Special Grashof'
elseif S + L > PQ
Condition = 'Non-Grashof'
end
Whenever I input this, for a=7, b=11, c=8, and d=9, it gives me that S=49 and L=57. I want S=7 and L=11
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!