フィルターのクリア

Send "abort signal" to MEX

4 ビュー (過去 30 日間)
Fox Mulder
Fox Mulder 2021 年 7 月 27 日
コメント済み: Fox Mulder 2021 年 7 月 28 日
I'm playing around in Matlab with MEX-files, right now coding the mandelbrot set. Works well so far, except that with high zooms, the iterations have to go up and thus the execution takes a while. I'd like to send an "abort signal" to the MEX-code when I change settings in Matlab (for example new zoom factor), so that the MEX-code can immediatly start calculating the new settings. Is it possible to, for example, update a variable used in MEX (maybe a variable in workspace that a pointer in MEX points to)? Like a boolean "abort" that I can check in the iteration-loops in MEX?

採用された回答

Jan
Jan 2021 年 7 月 27 日
You could check from inside the MEX function, is a key is pressed.
Or you can use mexCallMATLAB to run a drawnow command and request the status of a GUI object, e.g. a button. This takes some time, but it should be enough to trigger this every second.
  1 件のコメント
Fox Mulder
Fox Mulder 2021 年 7 月 28 日
Thank you, after a lot of struggle, I got the version with mexCallMATLAB to work. Needs a little change in my code, because I can't call mexCallMATLAB or return in a parallel for loop, but that's not a problem.
The version "key pressed" does work, however, only for keyboard. There are virtual key codes that refer to mouse-clicks, but they don't seem to do anything. Is this matlab-specific or maybe because there is no mex-window to click in?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by