Prevent mlint warning for onCleanup like return value
古いコメントを表示
I wrote a function, similar to onCleanup. I noticed that Matlab does not give a mlint warning for the following code.
dummy = onCleanup( @() some_func );
But for my own function
dummy = MyOwnCleanup( @() some_func );
I get the warning Value assigned to variable might be unused, which I need to silence with %#ok<NASGU>. Obviously, Matlab recognizes the onCleanup call and does not emit a warning. How can I acchieve similar behaviour for my own MyOwnCleanup function?
4 件のコメント
Rik
2024 年 7 月 2 日
This is probably not possible without major interference with the editor. It will probably be an ugly hack.
A much easier hack is to overload the built-in onCleanup function. I don't think I would recommend this.
What exactly is your version doing? I might be interested in using it myself.
tommsch
2024 年 7 月 2 日
tommsch
2024 年 8 月 23 日
Umar
2024 年 8 月 24 日
Hi @ tommsch,
You mentioned,” You just repeated my question and *all the stuff I know* “
Now, in your posted comments, you mentioned,
“I wrote a function, similar to onCleanup. I noticed that Matlab does not give a mlint warning for the following code. dummy = onCleanup( @() some_func );”
Could you please click the mathworks mlint documentation link below and tell me what does it say about mlint
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Debugging and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

