I've done a lot programming in C & C++ and others. In all these development environments they all have one thing in common: there is a debugger. I don't know any programmer who doesn't make mistakes. Since I'm having problems with the example code, it sure would be nice if I could debug this code! Aside from putting in statements that will show the contents of variables after leaving a for loop, it sure would be nice to see how the people who developed these examples went about debugging it. I really don't think any programmer makes an example without making mistakes! Did they just throw in a bunch of printf statements? From what I've heard SciLab was developed using Qt. If that is so then I can see where the SciLab developers were using the debugging capabilities of that development IDE.
I have found the debug help file and this will solve many debug questions.