Indexing of a temporary array.

x=(meshgrid([1 2 3],[1 2 3]).*meshgrid([1 2 3],[1 2 3])')
x=x(:)'
Is it possible to carry out the above 2 operations in a single line code. Or in other works is there a way to go around the restriction in Matlab 'A temporary array cannot be indexed'.? Thanks in Advance.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 20 de Oct. de 2012

0 votos

x = reshape( (meshgrid([1 2 3],[1 2 3]).*meshgrid([1 2 3],[1 2 3])'), 1, []);

Más respuestas (1)

Matt J
Matt J el 20 de Oct. de 2012
Editada: Matt J el 21 de Oct. de 2012

0 votos

x=kron(1:3,1:3);

Categorías

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by