[~, discrete_x] = histc(x, edges);discrete_x(discrete_x == length(edges)) = length(edges)-1;discrete_x(discrete_x == 0) = NaN;
This works for positive integers only. what do i do if i have to do it for negative integers?
discretize
[~, discrete_x] = histc(x, edges);discrete_x(discrete_x == length(edges)) = length(edges)-1;discrete_x(discrete_x == 0) = NaN;
Best Answer