Trying to apply conditionals

4 visualizzazioni (ultimi 30 giorni)
JAmyl Andino
JAmyl Andino il 24 Nov 2019
Commentato: Ridwan Alam il 24 Nov 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 Commenti
dpb
dpb il 24 Nov 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 il 24 Nov 2019
Great! Please make sure to mark this question as answered.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by