How can I get a cross-platform dbstop statement where a file separator is needed?

2 visualizzazioni (ultimi 30 giorni)
I need to insert a breakpoint into a class method at the beginning of a specific while loop. The position of this loop is subject to change over time, so I've put it in a function that I can reference. The class method is in its own file within a class folder that starts with '@'.
I can set the breakpoint on my Linux system with dbstop in @myClass/myFun>mainLoop, but this won't work on a Windows system where the command has to be dbstop in @myClass\myFun>mainLoop. I can reference a line number and get away without using the class prefix (e.g. dbstop in myFun.m at 30) but can't do the same with the function name (dbstop in myFun.m at mainLoop or dbstop in myFun at mainLoop).
I also tried putting this in an eval statement where the file separator was inserted into the command at run time, but eval interprets the file separator as an operator and gives me an error saying it's an invalid use of an operator.

Risposta accettata

Jan
Jan il 21 Set 2021
Modificato: Jan il 21 Set 2021
Do I understand correctly that you want to run
dbstop in @myClass/myFun>mainLoop
in Linux and under Windows:
dbstop in @myClass\myFun>mainLoop
? Then:
dbstop(fullfile('@myClass', 'myFun>mainLoop'))
% Or:
dbstop(['@myClass', filesep, 'myFun>mainLoop'])

Più risposte (0)

Categorie

Scopri di più su Debugging and Analysis in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by