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

1 Ansicht (letzte 30 Tage)
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.

Akzeptierte Antwort

Jan
Jan am 21 Sep. 2021
Bearbeitet: Jan am 21 Sep. 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'])

Weitere Antworten (0)

Kategorien

Mehr zu Debugging and Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by