필터 지우기
필터 지우기

Pausing scripts to wait for user to execute commands

조회 수: 37 (최근 30일)
Jeremy Young
Jeremy Young 2019년 2월 7일
댓글: Jeremy Young 2019년 2월 9일
Is there a way to pause a MATLAB script and wait for a user to execute some commands (e.g. brushing in the plot and then in the command window)?
Specifically, I want to select some data using the brush tool from the plot, but I want to select multiple groups and then deal with them later (i.e. with the remainder of my script). Typically, I could just do this in 2 parts, one to get the plot, and then after I brush the data and manipulate it into the right structure, run a secondary script to finish up. However, my issue is that I need to do this for a number of different datasets which I was looping through. Changing the parameters to get to the next dataset manually in addition to selecting the data manually seems too tedious for there not to be a better way.
I'm familiar with
pause
and things such as
x = input('Enter something: ')
But this only pauses the script, rather than suspending it to allow the user to interact with the data freely. I think I can brush data and save as variables during a pause, and if I was always going to brush the same number of variables, then this would be fine, but I will select groups based on how the data looks. And because they will be different sizes, I would then save the data in a cell to manipulate in further parts.
I could see such functionality also being useful later if I want to explore the data in the future. See a plot and then want to do something more to it.

채택된 답변

Walter Roberson
Walter Roberson 2019년 2월 8일
keyboard() -- but you have to know to dbcont to continue afterwards.
  댓글 수: 1
Jeremy Young
Jeremy Young 2019년 2월 9일
Thanks, I had a feeling it had something to do with debugging. I didn't think having to insert a break point everytime would be the best solution, and that there must have existed a programatic way to do so.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by