How can I write a Matrix with different elements by typing in a single command?
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I have a matrix of
[0 0 0 0 0; 0 0 1 10 20; 0 0 2 8 26; 0 0 3 6 32]
How can this be written in Matlab using a single command line.
1 comentario
Geoff Hayes
el 19 de Abr. de 2018
Talal - why one line of code? The obvious is
A = [0 0 0 0 0; 0 0 1 10 20; 0 0 2 8 26; 0 0 3 6 32];
but I suspect that isn't what you had in mind since it isn't making use of the pattern in your non-zero block (+1,-2,+6). Are you trying to define a pattern and then generate a matrix from it?
Respuestas (1)
James Tursa
el 19 de Abr. de 2018
By putting it all on one line:
[0 0 0 0 0; 0 0 1 10 20; 0 0 2 8 26; 0 0 3 6 32]
But why do you need it on one line? The multi-line version is more readable.
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!