필터 지우기
필터 지우기

Zooming in on generated graph in order to get input value for a prompt

조회 수: 2 (최근 30일)
Ines Shekhovtsov
Ines Shekhovtsov 2022년 12월 7일
댓글: Voss 2022년 12월 9일
Hello,
I have a code that generates an EMG plot of three breathing attempts. After the plot code i have an input prompt that asks user to select closest x axis value for one of the chosen 3 attempts. This requires user to zoom in on generated plot. But i cannot seem to do that when the dialog box prompt comes up. Is there a way to be able to zoom in on generated graph to get value i need in a more elegant way??
my prompt code is:
prompt = {'What is the 0 point value of selected attept?'};
dlgtitle = 'Input';
answer = inputdlg(prompt,dlgtitle)
x=str2double(answer);

채택된 답변

Voss
Voss 2022년 12월 7일
By default, inputdlg creates a modal dialog box (modal meaning no other figure/window can be interacted with while the modal one is up). To allow interactions with other figures/windows, change the inputdlg WindowStyle to 'normal' (this is done with the fifth input argument to inputdlg, so you also have to supply values for the third and fourth input arguments to inputdlg):
prompt = {'What is the 0 point value of selected attempt?'};
dlgtitle = 'Input';
answer = inputdlg(prompt,dlgtitle,1,{''},struct('WindowStyle','normal'))
x=str2double(answer);
  댓글 수: 2
Ines Shekhovtsov
Ines Shekhovtsov 2022년 12월 9일
Thank you for your response. I had thought about using ginput as a more elegant approach and using a click vs reading a value from graph and input that in yourself. However ginput does not allow for zoom during it's execution. Do you have any idea on how i may go about accomplishing what i need using something similar to ginput??
Voss
Voss 2022년 12월 9일
Maybe datacursormode will be useful. The user can switch between zoom/pan/datacursor modes while looking for the correct point, and clicking on the line when datacursormode is on shows a datatip with the x and y values (also you can use the directional arrow keys to adjust the location of the datatip along the line).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by