Indexing of a temporary array.

1 visualizzazione (ultimi 30 giorni)
Vinod S
Vinod S il 20 Ott 2012
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.

Risposta accettata

Walter Roberson
Walter Roberson il 20 Ott 2012
x = reshape( (meshgrid([1 2 3],[1 2 3]).*meshgrid([1 2 3],[1 2 3])'), 1, []);

Più risposte (1)

Matt J
Matt J il 20 Ott 2012
Modificato: Matt J il 21 Ott 2012
x=kron(1:3,1:3);

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by