Yolu can simply use logical indexing for this, find is not absolutely necessary.
However, if you want to use find, assign its output to a variable:
idx = find(vector>0);
PosVals = vector(idx);
Testing for the negative values and then eliminating them requires an extra step:
idx = find(vector<0);
posidx = setdiff((1:numel(vector)), idx);
PosVals = vector(posidx)
Experiment to get different results.
Best Answer