Trying to apply conditionals

4 Ansichten (letzte 30 Tage)
JAmyl Andino
JAmyl Andino am 24 Nov. 2019
Kommentiert: Ridwan Alam am 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 Kommentare
dpb
dpb am 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 am 24 Nov. 2019
Great! Please make sure to mark this question as answered.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by