Borrar filtros
Borrar filtros

How do I declare E=[1,-7,3,-9,5]

1 visualización (últimos 30 días)
Reynaldo Ponce
Reynaldo Ponce el 25 de Feb. de 2019
Respondida: Bob Thompson el 25 de Feb. de 2019
for an assignment I was given
  1. Declare and suppress the output of the following variables in the most succinct manner possible:
A=[1,2,3,4,5]
B=[2,5,8,11,14]
C=[20, 15, 10, 5, 0]
D =[-5, -4, -3, -2, -1]
E = [1, -7, 3, - 9, 5]
I did
A=[1:5]
B=[2:3:14]
C=[20:-5:0]
D=[-5:-1]
but for E I couldnt figure it out, any suggestions please.

Respuesta aceptada

Bob Thompson
Bob Thompson el 25 de Feb. de 2019
You can define each element of an array individually if you would like. Defining E should be pretty much exactly as it is listed.
E = [1, -7, 3, - 9, 5]; % For a single row array. Use ';' between elements for a single column array.

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by