Create the same number repeatedly in a single array.
75 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Eranja Noopehewa
el 2 de Ag. de 2018
Respondida: Surbhi Pillai
el 2 de Ag. de 2018
I want to create a matrix of size 1*12 where i have 300 300 300 300 300 300 600 600 600 600 600 600 my array shoul look like X=[300,300,300,300,300,300,600,600,600,600,600,600].. Is there a easy way to create this matrix
0 comentarios
Respuesta aceptada
Surbhi Pillai
el 2 de Ag. de 2018
Hi Eranja,
I understand you are trying to create a matrix with repeated values. You can try using 'ones' function to create such a matrix.
Following is an example to create a matrix X=[300,300,300,300,300,300,600,600,600,600,600,600]...
X=[300*ones(1,6),600*ones(1,6)];
Hope it helps....
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!