Skip to content
Snippets Groups Projects
Commit e873daa8 authored by Olivier Sauter's avatar Olivier Sauter
Browse files

update from CHEASEgui

parent f216757b
No related branches found
1 merge request!119update from CHEASEgui
Pipeline #103849 passed
function [is,sigi]=iround_os(sig,val)
%
% Given two arrays sig and val, for each element in val
% Given two arrays sig and val, for each element in val
% returns the index and value of the nearest element in sig.
%
%
% sig and/or val can be non-monotonic (contrary to TCV iround which requires sig to be monotonic)
%
% Example:
......@@ -11,7 +11,8 @@ function [is,sigi]=iround_os(sig,val)
%
%
%
for j=1:length(val)
[s(j),is(j)]=min(abs(sig-val(j)));
is = zeros(size(val));
for j=1:numel(val)
[~,is(j)]=min(abs(sig-val(j)));
end
sigi=sig(is);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment