I think the attached function do what you expect
Serge Steer
Le 01/12/2014 17:15, David Chèze a écrit :
Hi all,
I have timeseries with measurements at every timestep and I would like to
define bins of values for every variable and be able to count the number of
records that are in each bin: for 2 variables X and Y with 3 and 5 bins
respectively for example, the results is a matrix 3x5 where i,j element is
: the number of measurements that are in the ith bin of X and jth bin of Y.
I wonder if there is a direct function to address this common problem of
classification/sorting in scilab or toolbox like stixbox or nan_toolbox or ?
Thanks for your advice,
David
--
View this message in context:
http://mailinglists.scilab.org/frequency-analysis-of-N-variables-tp4031497.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
function occ=dsearch2D(xy,dx,dy,opt)
//xy, coordinates of the points of the cloud
//dx, discretization of the x axis
//dy , discretization of the y axis
//occ, table such as occ(i,j) contains the number of points in the
//pixel [dx(i) dx(i+1)) x [dy(j) dy(j+1))
if argn(2)4 then opt='c';end
if and(opt[c,d]) then
error(msprintf(_(%: unknown char specifier (must be ''c'' or
''d'')\n),dsearch2D))
end
if size(xy,2)2 then
error(Wrong dimension for first argument)
end
[indx,occx]=dsearch(xy(:,1),dx,opt);
occ=[];
dy=matrix(dy,1,-1);
for k=1:length(dx)-1
i=find(indx==k);
[indy,occy]=dsearch(xy(i,2),dy,opt);
occ=[occ; occy];
end
endfunction
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users