Interrupt MATLAB programmatically on Windows -


when using matlab through gui, can interrupt computation pressing ctrl-c.

is there way same programmatically when using matlab through the matlab engine c api?

on unix systems there solution: send sigint signal. not kill matlab. it'll interrupt computation. looking solution works on windows.


clarifications (seeing answerer misunderstood):

i looking way interrupt matlab calculation, without having control on matlab code being run. i'm looking programmatic equivalent of pressing ctrl-c in @ matlab command window, on windows systems. a mathematica-matlab interface: need forward interrupts mathematica matlab. mentioned above, have working implementation on unix; question how on windows.

one way make matlab engine session visible, prior executing long computations. way if want interrupt execution, bring visible command window focus , hit ctrl-c.

this can done using engsetvisible function

here quick example tried using matlab com automation. process should similar since matlab engine implemented using com on windows (pipes used on unix instead).

the scripting done in powershell:

# create matlab automation server $m = new-object -comobject matlab.application $m | get-member  # make command window visible $m.visible = $true  # execute long computation: pause(10) $m.feval('disp', 0,[ref]$null, 'press ctrl-c interrupt...') $m.feval('pause', 0,[ref]$null, 10)  # close , cleanup $m.quit() $m = $null remove-variable m 

during pause, can break hitting ctrl+c in command window:

cmd-window


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -