How to create a matrix with ones and zeros in one line?

3 visualizaciones (últimos 30 días)
Danny Orsic
Danny Orsic el 11 de En. de 2021
Comentada: Danny Orsic el 11 de En. de 2021
I am trying to build these matrices but we can only use one operator. Any help on how to build these with one operator would be great.

Respuestas (1)

Image Analyst
Image Analyst el 11 de En. de 2021
Did you use the equals sign, which is the assignment operator?
m19 = [1,0,0,1,1;
0,1,0,1,1];
m20 = [0,0,1,1;
0,0,1,1
0,0,0,0
1,1,1,1]
  1 comentario
Danny Orsic
Danny Orsic el 11 de En. de 2021
We can't just type the numbers in we have to use operators like colon, linspace or transpose to name a few we are working with right now.

Iniciar sesión para comentar.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by