r/scilab 23d ago

Debugging Scilab Scripts in Windows - The Easy way using PAUSE and not trying to run the debugger!

Since starting to support this subreddit, I've often found that I need to debug my scripts. I've found the Command Line Debugger doesn't even want to work on my system and besides I've found a better way that works for me.

If one looks up the "pause" command, you'll see it mentions "The pause is very useful for debugging purposes."

The method: Just place a "pause" command in your script where you want a program breakpoint and run the script as normal. When SCILAB hits that pause command, you'll get a "-1->" in the console window and every variable that has been created up to that point is available to you. You can do all sorts of commands on the variables. Typically for me, I've got a dimensional issue that I need to resolve so I'm doing size(variable1), size(variable2) to understand why my plot isn't generating or why other functions are complaining.

Note: To get temporary variable values of a function, one must place a pause command within the function.

Caution: You most likely have the ability to change the values of the variables also so watch what inquiry commands you're doing in this state.

The "resume" command will get you to the next "pause" (or the same one if you're inside an iteration loop) or the program will run to completion. "whereami()" command comes in handy if you've got multiple "pause" commands and forget where you're at in the program. The "abort" command will cause the program to terminate.

Any SCILAB experts want to weigh in, feel free.

1 Upvotes

0 comments sorted by