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 CenterFile Exchange에서 Workspace 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