basics - a more compact way to do this...?
1 次查看(过去 30 天)
显示 更早的评论
I have a size(x) function that gives answer: 1 23 (x is a vector with 23 points). I can take the second value like this
k=size(x)
k(2)
Is there a more immediate way to do this? in a single command, something like.. size(x)(2) ?
0 个评论
采纳的回答
Sven
2011-11-14
The simplest method is:
k = size(x, 2)
The second argument of the "size" method is the dimension in which to query - in your case the 2nd dimension
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!