Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
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

Respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by