How to create a matrix with for-loop when the columns are unknown?

I want to find the intersections of multiple points (known) to a function when the number of intersections for each point is unknown. For one point I have:
intersections=find(abs(y_function-y_point)<=(0.001));
how do I create a matrix, that includes the intersections for n points?
Thank you in advance

 Accepted Answer

Let y_point - vector [n x 1]
[ii,jj] = find(abs(bsxfun(@minus,y_function(:),y_point(:)')) < 1e-3);

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!