Hi . what is the difference between numel() and length() of a given vector ?
144 次查看(过去 30 天)
显示 更早的评论
what is the difference between numel() and length() of a given vector ?
0 个评论
采纳的回答
KSSV
2021-10-6
编辑:KSSV
2021-10-6
numel gives you total number of elements present in the array. i.e. it is product of result of size function.
A = rand(10,3) ;
numel(A)
size(A,1)*size(A,2)
length gives you maximum number of size or which ever is dominant along row and column.
A = rand(10,3) ;
length(A)
size(A,1)
%
B = A' ;
length(B)
size(B,2)
更多回答(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!