dimanche 12 février 2017

find the signed minimum value in a three dimensional matrix in MATLAB

Vote count: 0

I have a 3D matrix d and I want to find the signed minimum value along the third dimension. Currently, I use following code

tmp = abs(d);
[row, col]=ndgrid(1:size(d,1),1:size(d,2));

[v,ind] = min(tmp,[],3); 
index = row + size(d,1)*size(d,2)*(ind-1)+ size(d,1)*(col-1); %turn the ind to index
dm = d(index); %get the signed minimum value

The above code does not so efficient. Does anyone know a better choice? Thank you!

asked 17 secs ago

Let's block ads! (Why?)



find the signed minimum value in a three dimensional matrix in MATLAB

Aucun commentaire:

Enregistrer un commentaire