How to automatically scroll editor to specific place in code after asking for user input?
1 次查看(过去 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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!