Suppose you defined a function. Does it get erased when you clear the screen or does it remain in the memory?
Session 1: Scilab Environment
A beginner is usually apprehensive when starting to learn a new software. The best way to get acquainted with a new software is to study its working environment and learn how to get help in learning the software. The best form help is online help that the software offers right there on the screen. Next, you must learn a few shortcuts that make working in the software easy and quick.
In this session you will learn the following:
- Visible components of Scilab, the Scilab console
- Invisible component of Scilab, the Scilab workspace
- Invoking online help
- Working in Scilab console
- Closing Scilab session
Visible Components of Scilab Environment
When you start Scilab, you see the Scilab console, with the command prompt waiting for you to type a valid Scilab command. In addition to the console, Scilab has other environments, namely:
- Editor (called SciNotes),
- Variable Browser and Editor,
- History Browser,
- Scilab Help,
- ATOMS (AuTOmatic Modules Management for Scilab) and
- Variable Browser and Editor, History Browser and ATOMS were introduced in Scilab version 5 and are not available if you are using an older version of Scilab.
- Xcos is the revamped replacement for Scicos of the older versions of Scilab.
When you start Scilab, only the console is open and the other environments are not. Choose the environment you want to use from the Main Menu under Applications.
It is possible to dock all these environments into the console window by dragging the environment you wish to dock and dropping it into place in the console. However, a beginner will take some time to master this operation.
For more details about these environments, visit this link on the Scilab website.
Invisible Components of Scilab Environment
While the above are the visiblle components of Scilab environment, there is the invisible component of Scilab, the Scilab Workspace. Workspace is the memory space where Scilab stores its environment variables, constants, variables, compiled functions and libraries. The Variable Browser and Editor offers a view of the Workspace contents, it shows only the environment variables, constants and variables but not the functions and libraries. Further, it does not permit clearing variables from the Workspace. Thus, until it is improved, we will view and manipulate the Workspace using commands such as who, whos, clear, save, load etc.
Invoking Online Help in Scilab
Scilab provides online help in a browser like environment, and is similar to the online manual of *nix, namely, man. Help can be invoked in a number of ways:
- Use mouse to choose Main Menu -> ? -> Scilab Help
- Type F1 from the console
- Command help <cr> typed at the command prompt. This opens the Scilab Help browser where you can browse through the Table of Contents or use the Search feature.
- Command help pattern <cr> typed at the command prompt. This opens the Scilab Help browser and shows all commands or contents matching the patterns you entered.
Working with Scilab Console and Some Useful Console Shortcuts
Scilab console is similar to the terminal in *nix or MS DOS Prompt of Windows. It is a shell that interprets the command typed by the user, executes the command and displays the results.
- Scilab commands are case sensitive. the characters A and a are distinct.
- To let Scilab console know the command is complete, press the Enter key. Only then does the command get executed.
- If you type a command that Scilab does not understand, it will display an error message.
- Commands you type may be names of variables, names of Scilab functions or names of user defined functions currently loaded into Scilab Workspace (we will see how to do this when we discuss Scilab functions in a later session)
A beginner should quickly master the following things to become comfortable working in the Scilab console:
- To clear the screen type the clc <cr> at the command prompt or simply press the F2 key.
- To abort a command midway without executing it, press the Esc key on the keyboard.
- Scilab offers command completion, similar to the feature available in bash shell in *nix (Unix, Linux). Press the Tab key to use the command completion feature. You will be shown a list of commands matching the pattern already typed and you can scroll through the list and choose one of them or type more characters to reduce the list of matching commands.
- A history of previous commands is stored and you can scroll through this history by pressing the Up or Down arrow keys on your keyboard. Alternately, you can open the History Browser environment. You can edit any previous commands using Left Arrow, Right Arrow, Home and End keys to move about the command and Backspace and Del keys to delete characters and you can type in new characters. This feature is again similar to the one in bash shell.
You can close Scilab in one of the following ways:
- Type the exit <cr> or quit <cr> command at the command prompt. Actually, quit either terminates the Scilab session or decreases the pause level. Thus, if you have paused the session, you may not actually terminate the session.
- From the main menu, choose File -> Quit.
- Click on the Close button on the Scilab console window.
Watch the screencast on YouTube