Hi . what is the difference between numel() and length() of a given vector ?
144 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Babacar Dieng
el 6 de Oct. de 2021
what is the difference between numel() and length() of a given vector ?
0 comentarios
Respuesta aceptada
KSSV
el 6 de Oct. de 2021
Editada: KSSV
el 6 de Oct. de 2021
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)
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!