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.

 採用された回答

Walter Roberson
Walter Roberson 2012 年 10 月 20 日

0 投票

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

その他の回答 (1 件)

Matt J
Matt J 2012 年 10 月 20 日
編集済み: Matt J 2012 年 10 月 21 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by