filtering result in matlab
1 回表示 (過去 30 日間)
古いコメントを表示
this is a set of possible solutions i get from my code.but i only need three values but i get 6 possible solutions.i know that my solution can neither be negative nor it can be complex and it should show only accepted answer after ignoring other solution
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/369043/image.png)
there are 6 possible solutions but only three are right. now how to use loop maybe to ignore left entries as it is negative and it should only display right entries as solution
0 件のコメント
採用された回答
その他の回答 (1 件)
Ameer Hamza
2020 年 9 月 30 日
idx = any(possibleSol < 0);
possibleSol(:, idx) = []
It will remove any column with negative value in it.
2 件のコメント
Walter Roberson
2020 年 10 月 1 日
idx = any(possibleSol < 0) | any(imag(possibleSol) ~=0);
possibleSol(:, idx) = []
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!