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!