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

1 vue (au cours des 30 derniers jours)
mina massoud
mina massoud le 8 Juil 2019
Commenté : mina massoud le 8 Juil 2019
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 commentaires
Stephen23
Stephen23 le 8 Juil 2019
Modifié(e) : Stephen23 le 8 Juil 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 le 8 Juil 2019
thank you very much , i accept ur wonderful answre now.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by