Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
|
Re: match matrix to closest values
Posted:
Jun 16, 2013 3:34 AM
|
|
"Y " <nospamhere@dispostable.org> wrote in message <kphglh$klb$1@newscl01ah.mathworks.com>... > > That's a good way to use interp1 I wasn't aware of, thanks. > Do you have a suggestion on how to get back the indices back from interp1? Or is the best one find(ismember(h,val))?
Simply do this:
idx = interp1(h,1:length(h),needle,'nearest')
% Bruno
|
|
|
|