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

1 visualización (últimos 30 días)
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.

Respuesta aceptada

Jan
Jan el 21 de Sept. de 2021
Editada: Jan el 21 de Sept. de 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'])
  2 comentarios
Josh G.
Josh G. el 21 de Sept. de 2021
Thanks, I'm not able to find this syntax anywhere in the documentation but it seems to work.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Debugging and Analysis en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by