Wednesday, July 18, 2012

using Scilab code in TCL-TK (tutorial)

The key to use Scilab code in TCL-TK interpreter is a command called ScilabEval. As the name implies, the command is responsible for evaluation of Scilab commands (syntax) inside TCL-TK. The following hints are to be considered when using this command:

1. Syntax

The command should be used in this manner

You can use this command many times in a single line like the following

2. Common mistakes

The Scilab code should start and end with double quotation mark (") not single quotation mark ('), otherwise an error will be returned by Scilab console.

 Also, the Scilab code should all be placed in one line not in multi lines, otherwise the first line only will be executed.

If you want to use strings in the Scilab code use single quotes (') instead of double quotes in order to prevent Scilab from confusing or misunderstanding of start and end quotes.

A simple explanation of this problem is that Scilab detects only the first and second occurrences of the double quotes and executes what is between them.

I think these are the common mistakes and problems that may make you pull out your hair if you don't know them.