Filter löschen
Filter löschen

hi every one , i need help to do this in matlab if it's possibile, thank you

2 Ansichten (letzte 30 Tage)
A=[ 1 2 3 4 5 6 7 8 9 10 ]
B=[ 10 11 12 13 14 15 16 17 18 19 20]
C=[ 21 22 23 24 25 26 27 28 29 30]
for n=1:10
if n==1 & 6<=n<=9 % if n is uquale to this value i need to make this operation
X=A+B
if n==2 & 3<=n<=5 % if n is uquale to this value i need to make this operation
X=A+B+C
else % else in need to make this
X=B+C
end
end
tnak you
  2 Kommentare
Stephen23
Stephen23 am 8 Jul. 2019
Bearbeitet: Stephen23 am 8 Jul. 2019
Disregarding the MATLAB syntax bug, when do you expect these logical conditions to be true?:
n==1 & 6<=n<=9
n==2 & 3<=n<=5
Can you give any value of n for which this will be true? Fixing the syntax bug gives:
n==1 & 6<=n & n<=9
n==2 & 3<=n & n<=5
but still no value of n that will ever produce a true output. Did you really mean to use OR ?:
n==1 | (6<=n & n<=9)
n==2 | (3<=n & n<=5)
mina massoud
mina massoud am 8 Jul. 2019
thank you very much , i accept ur wonderful answre now.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by