Indexing of a temporary array.

1 Ansicht (letzte 30 Tage)
Vinod S
Vinod S am 20 Okt. 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.

Akzeptierte Antwort

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

Weitere Antworten (1)

Matt J
Matt J am 20 Okt. 2012
Bearbeitet: Matt J am 21 Okt. 2012
x=kron(1:3,1:3);

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by