Trying to apply conditionals

조회 수: 4 (최근 30일)
JAmyl Andino
JAmyl Andino 2019년 11월 24일
댓글: Ridwan Alam 2019년 11월 24일
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
dpb
dpb 2019년 11월 24일
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 2019년 11월 24일
Great! Please make sure to mark this question as answered.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by