logic in matlab to filter result

2 views (last 30 days)
HELLO everyone.
i have a little query,.plzz answer in brief for better understanding.
actually i am getting the following two solutions as mentioned in each column as x,y and z.now i want to only keep the column in which value of z(bottom value) is positive.
plzz correct the code and mention it in comments.
idx = any(possibleSol < 0) | any(imag(possibleSol) ~=0);
possibleSol(:, idx) = [ ];

Accepted Answer

Image Analyst
Image Analyst on 18 Nov 2020
Try this
% Extract z from the last row of possibleSol.
z = possibleSol(3, :);
% Find out which columns have the last row (z) as positive.
goodColumns = z > 0;
% Extract only those columns where z > 0
possibleSol = possibleSol(:, goodColumns)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!