Indexing of a temporary array.
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Walter Roberson
2012-10-20
x = reshape( (meshgrid([1 2 3],[1 2 3]).*meshgrid([1 2 3],[1 2 3])'), 1, []);
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!