conversion
18 次查看(过去 30 天)
显示 更早的评论
how can we convert scalar to vector
0 个评论
采纳的回答
Paulo Silva
2011-4-24
In MATLAB a "scalar" is a vector with just one element, for example [1] is the same as 1
here's a sneaky way to separate all the digits of a scalar into columns of a vector
nc=1010; %my scalar value
nv=num2str(n)-'0' %my vector
0 个评论
更多回答(2 个)
Walter Roberson
2011-4-24
If S is your scalar, you can use any of the following:
reshape(S,1,[])
reshape(S,[],1)
S(:)
S.'
S(end) = S;
kron(S,1)
full(sparse(S))
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!