Trying to apply conditionals

4 visualizaciones (últimos 30 días)
JAmyl Andino
JAmyl Andino el 24 de Nov. de 2019
Comentada: Ridwan Alam el 24 de Nov. de 2019
Hi!, I have a simple array of four number a=[L1 L2 L3 L4] for which i already sorted the max(L) and min(s) numbers, I would like to sum the remaining two, so I'm trying to make the following condition in order to sort out those 2 numbers remaining. Here's what I'm doing:
if (L1>s) && (L1<L)
disp: (p)
This is not working but it's what I've seen on the tutorials or conditioning, any help?
  6 comentarios
dpb
dpb el 24 de Nov. de 2019
L(1)=input('Enter value for L1:');
L(2)=input('Enter value for L2:');
L(3)=input('Enter value for L3:');
L(4)=input('Enter value for L4:');
Lmx=max(L);
...
No sense in keeping the same data in two places -- you have it in L1 thru L4 and then just copy it to an array. Make the array in the first place..."It's the MATLAB way!" :)
Ridwan Alam
Ridwan Alam el 24 de Nov. de 2019
Great! Please make sure to mark this question as answered.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by