How to pause code till specific key is pressed?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I want to do the following automatically:
- open figure
- select 2 datapoints with my mouse.
- read the index of those 2 datapoints, using the below code
dcm_obj = datacursormode(gcf);
info_struct = getCursorInfo(dcm_obj);
4. close figure
5. continue with the rest of the code.
Problem is, I don't know how to pause the script for it to wait till I finish selecting my datapoints.
I don't mind pressing a specific key after finish selecting the 2 datapoints.
THANK YOU!
댓글 수: 0
답변 (1개)
thoughtGarden
2019년 10월 10일
편집: thoughtGarden
2019년 10월 10일
Seems like you could do this more easily like this:
[x,y] = ginput(2);
This allows you to get the data for two locations before it continues with your script. No need to press a specific key after.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!