Stop Script From Another Window

2 ビュー (過去 30 日間)
Cody Gass
Cody Gass 2014 年 8 月 30 日
編集済み: Image Analyst 2014 年 8 月 30 日
I want to make a script that performs a few actions repeatedly until I want it to stop. However, the actions are clicks in a different program (Google Chrome, to be exact). I could go to the MatLab console and ctrl+C from there, but that's very inconvenient due to the click being just a few seconds apart from each other. Is there any way I could stop the script without returning to MatLab?
  1 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 8 月 30 日
Cody - so you start the script from within MATLAB, yet you do not want to stop it from within MATLAB. How do you know when you want it to stop - after two actions, three actions, four or ? Can you not just provide the number of actions to perform as input to your script?

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

回答 (1 件)

Image Analyst
Image Analyst 2014 年 8 月 30 日
編集済み: Image Analyst 2014 年 8 月 30 日
If both programs were MATLAB scripts, you could write the first program to check a variable in the base workspace using evalin(). If the variable is true, keep going, but if it's false, exit the program. The second program would set the variable using assignin() to false when it wants the first program to stop.
However if second program is Chrome, then it really depends on what's going on in Chrome. Does Chrome interact with a page that runs a MATLAB program? Or is it just looking at some arbitrary web page and your script is supposed to somehow recognize, with urlread(), a condition that indicates it should shut itself down.

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by