MATLAB: Using find() on a vector of objects comparisonfaq 6.1findfloating pointsearchvector I'm trying to use find(…) to locate objects in a vector but can't make it work. I thought the following syntax would work: p = find( obj.x == 1 ) but it doesn't. Why? Best Answer do you want:p = find ( [obj.x] == 1 )if not, as suggested earlier can you show obj.x and the error message you get. Related SolutionsMATLAB: How to use find for a vector without a loop Hi!If you want to find all the locations in which vector_with_dates contains ANY of the dates in V_dates, use ismember[tf,loc]=ismember(vector_with_dates,V_dates)find(tf) MATLAB: Issue with find() It is not advised to compare floating point numbers using ==. You have to fix a small number (tolerance) say, eps = 10^-5 and check for is the absolute difference less then that. If so then the floating point numbers are close enough. 'More on:http://in.mathworks.com/matlabcentral/answers/74074-how-to-find-the-position-index-of-a-floating-point-number-in-matrix Related QuestionOverloaded method defined in class definition, not workingIssue with find() function2 comparisons in find(…)Compare 2 arrays with find()How to find the number of an element in a vectorFind() not as expected
Best Answer