MATLAB: Convert two array to a sparse matrix

Posted by CziX on Stack Overflow See other posts from Stack Overflow or by CziX
Published on 2010-04-27T20:31:53Z Indexed on 2010/04/27 20:33 UTC
Read the original article Hit count: 406

Filed under:
|

I'm looking for an a command or trick to convert two arrays to a sparse matrix. The two arrays contain x-values and y-values, which gives a coordinate in the cartesian coordinate system. I want to group the coordinates, which if the value is between some value on the x-axes and the y-axes.

% MATLAB
x_i = find(x > 0.1 & x < 0.9);
y_i = find(y > 0.4 & y < 0.8);

%Then I want to find indicies which are located in both x_i and y_i

Is there an easy way to this little trick?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about sparse-matrix