フィルターのクリア

Saving vector result from each loop if solution is correct.

2 ビュー (過去 30 日間)
Deokjae Jeong
Deokjae Jeong 2021 年 10 月 31 日
コメント済み: Star Strider 2021 年 10 月 31 日
Let's say DMP.m uses fsolve and output a solution vector, named xx. It can be `Equation solved', 'No solution found', or 'Equation solved but inaccuracy possible.'
I want to store the vector if it tells `Equation solved'.
So for example, my code is
for r=1:10
DMP
if exitflag==1
xxx(r,:)=xx
end
end
Unrecognized function or variable 'r'.
But Matlab gives me the error message: Unrecognized function or variable 'r'.
Could you help me the coding?

採用された回答

Star Strider
Star Strider 2021 年 10 月 31 日
Use the exitflag output from fsolve to determine whether a solution was found.
.
  14 件のコメント
Deokjae Jeong
Deokjae Jeong 2021 年 10 月 31 日
Oh.... It works. I am so thankful to you. I learned a lot.
Star Strider
Star Strider 2021 年 10 月 31 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by