MATLAB: How to extract indices with a condition boolconditionindicesvector For example I have Y = X(X==42), but I need the indices also! Best Answer To find the index where X is equal to 42, type idx=find(X==42) Y=X(idx) Related SolutionsMATLAB: Find indices in accumarray syntax function idx = maxidx(x) [~, idx] = max(x);function idx = minidx(x) [~, idx] = min(x);Together with accumarray(OrbNO,elev,[],@(x) maxidx(x)-minidx(x), 0); MATLAB: Can I count the number of integers in an index and store it in a variable Yes.Xeq1 = numel(index);This is how I would do it. Related QuestionIndexingThe function for determining the position of a given value in an array.Restate in logical indexing
Best Answer