Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
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 comentarios
Stephen23
Stephen23 el 8 de Jul. de 2019
Editada: Stephen23 el 8 de Jul. de 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 el 8 de Jul. de 2019
thank you very much , i accept ur wonderful answre now.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by