Array Manipulation - Substituting matrices with vectors
3 次查看(过去 30 天)
显示 更早的评论
Hi all,
I am having trouble with array subscripts in MATLAB.
Say we have a matrix "M=pascal(9)"
I want to "use array subscripting" to assign the 4th column of M to a new vector named V.
This is my code:
M = pascal(10);
syms v
M(:,3) = v
I have looked everywhere on the internet and can't find any help. Thanks in advance
0 个评论
采纳的回答
Oleg Komarov
2011-9-6
The LHS is always the assigned value in MATLAB, i.e. you cannot assign something that do not exist yet:
v = M(:,4)
Are you using syms for any specific reason?
更多回答(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!