필터 지우기
필터 지우기

How to automatically scroll editor to specific place in code after asking for user input?

조회 수: 4 (최근 30일)
I have incorporated a "breakpoint-like" feature in my code that opens a dialogue box to ask the user if the background removal/peak finding is satisfactory. If I am unsatisfied and select "cancel" it functions like a breakpoint whereas if I am satisfied and select "continue" it evaluates the next section of code.
For completeness, here is the relevant section of code (FYI, my approach is based on this: https://www.mathworks.com/matlabcentral/answers/22626-ask-user-to-continue).
%% Adjust Peak Finding??? Continue Yes/No?
%https://www.mathworks.com/matlabcentral/answers/22626-ask-user-to-continue
promptMessage = sprintf('Satisfied with Background/Etalon Removal?,\nor Cancel to abort processing?');
button = questdlg(promptMessage, 'Continue', 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
return; % Or break or continue
end
This works well, but has the annoying feature that I have to manually scroll to the section where the relevant parameters are defined in order to change them (after changing them I re-run that section of code). Is there a way to programatically scroll the editor to a specific section of code if I select "cancel" (ie: unsatisfied)? The most useful approach would be to have a unique tag in the code for the desired line number as opposed to just scrolling to a specific line number because line numbers will change as I add/remove sections in the future.
Thanks in advance!
-Travis

답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by