0% found this document useful (0 votes)
68 views

Script Debug and Batch Execution

This document discusses how to debug scripts and run scripts in batch mode in Scilab. It describes functions like pause, whereami, and resume that allow debugging scripts by pausing execution at certain points. It also introduces utilities like scilab-cli and Scilex.exe for running Scilab scripts from the command line in batch mode on Linux and Windows respectively. An example is provided where pause is used to debug an infinite loop in a script.

Uploaded by

pepitogrillo_1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

Script Debug and Batch Execution

This document discusses how to debug scripts and run scripts in batch mode in Scilab. It describes functions like pause, whereami, and resume that allow debugging scripts by pausing execution at certain points. It also introduces utilities like scilab-cli and Scilex.exe for running Scilab scripts from the command line in batch mode on Linux and Windows respectively. An example is provided where pause is used to debug an infinite loop in a script.

Uploaded by

pepitogrillo_1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

7/29/2019 Script debug and batch execution | www.scilab.

org

Script debug and batch execution

 DOWNLOAD
DEBUG.SCI (SCI)

SCILAB language is often used to drive huge experiments/simulations along with complex computations in batch mode. But to do
so, you have to ensure your script is not crashing at every line. In this tutorial we will see together some handy functions for fast
script debugging as well utilities to run your scripts/functions in batch mode in Linux or Windows command line.

The script used in this tutorial is available for download using the above button.

Debug scripts: pause/whereami/resume/abort


Let's imagine a rst function which aims at deciding (random way) if you are team Captain or team Ironman.

And let's imagine a second function, leveraging the rst one, which should conclude with the fact that, eventually the team you
belong to does not really matter since you are Groot

And here you see what could be going wrong. Not that you are sharing your life with a talking raccoon, but the in nite loop! So
let's try a rst case

https://www.scilab.org/script-debug-and-batch-execution 1/4
7/29/2019 Script debug and batch execution | www.scilab.org

If you run your script that way, you will see that your script is never stopping. You got some good hints about where the scripts
might fail and would like to check the value of the di erent involved variables at those stage. You will therefore set pause element
(uncomment in provided code) and execute your code again.  In your SCILAB console you will then see the -1-> which means that
you reach a pause set.

Here you can therefore proceed with di erent actions:

Locate the reached pause set in your code using whereami function. We can for example check that the rst one has been
reached under line 3 of function myFunc2 and line 14 of myFunc1.
Unfold code execution with resume function
Access involved variable values within a pause. In this example, we are checking the value of e variable to check for an
eventual in nite loop.
Stop code execution using abort function. In this case e was TRUE which means that the loop was indeed in nite.

So one way to correct it would be to initialize y at FALSE.

Run SCILAB scripts in batch mode


Now that you understood what went wrong in script, that you corrected it and removed the pause sets, you are now able to run
your script in batch mode. To do so you have to access SCILAB provided utilities in installation folder (scilab-6.0.2\bin\).
Depending on the OS:

On Linux use scilab-cli utility

On Windows use Scilex.exe utility

It seems I was team Captain the whole time.

https://www.scilab.org/script-debug-and-batch-execution 2/4
7/29/2019 Script debug and batch execution | www.scilab.org

Sitemap

Download

Tutorials

Industries

Technology

Services

Software

Cloud

About

GET IN TOUCH


WORK WITH US
Email: [email protected]
Web: http://scilab.io/company/careers/

3 bis rue Saarinen


94528 Rungis - France

ESI Group - 2018


Cookie settings | Privacy & Terms Of Use
Legal notice | Donate

https://www.scilab.org/script-debug-and-batch-execution 3/4
7/29/2019 Script debug and batch execution | www.scilab.org

Tweets by @Scilab
Scilab Retweeted

Boost 4.0
@boost4_0
Today in Portugal at our #GA meeting #boost40. More news from our pilots in the next newsletter, don’t miss it.
@IMetrology_ES @FillGurten @BENTELER_Group @vwportugal @gestamp_es

Embed View on Twitter

https://www.scilab.org/script-debug-and-batch-execution 4/4

You might also like