please explain function [dum,z]
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
[dum,z] = min([sq_dist1;sq_dist2],[],1);
0 comentarios
Respuestas (1)
Michael Haderlein
el 30 de Sept. de 2014
from the Matlab help:
C = min(A,[],dim)
[C,I] = min(...)
So, [sq_dist1;sq_dst2] is an array (most likely 2-dimensional) whose minimum will be searched.
[] is required as otherwise the array will be compared with the value of this parameter:
min(3,2) -> 2
1 is the dimension along which the minimum values are searched. To understand, just check the difference between
min(magic(3),[],1)
and
min(magic(3),[],2)
That should make it clear.
[dum,z] are the values which are returned. In this case, I suppose dum stands for dummy which means you are actually not interested in this variable, but you need it to get the second parameter. Note that in later releases, you can also use [~,z] which is little more memory efficient. z indicates the indices at which the minimum values are found.
0 comentarios
Ver también
Categorías
Más información sobre Number Theory 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!