Use of ":"operator in matlab?
1 次查看(过去 30 天)
显示 更早的评论
Let say i have a matrix; x=[2 3;4 5] % 2 rows 2 columns
then i enter command , x(:)=[2;3;4;5] % 4 rows 1 column
What is happening here?
Is there any possiblity that i get 1 row 4 columns?If yes,how?
0 个评论
采纳的回答
madhan ravi
2020-6-21
(:) forces the matrix to a column vector, all you need is
reshape(matrix, 1, [])
2 个评论
madhan ravi
2020-6-23
编辑:madhan ravi
2020-6-23
“Only when used on the RHS of an assignment”
Exactly what the OP was asking and I was referring too. Was expecting your comment a bit earlier though ;). But thank you for explaining the details.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!