This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Session 1: Scilab Environment


Objectives

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:

  1. Visible components of Scilab, the Scilab console
  2. Invisible component of Scilab, the Scilab workspace
  3. Invoking online help
  4. Working in Scilab console
  5. 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:

  1. Editor (called SciNotes),
  2. Variable Browser and Editor,
  3. History Browser,
  4. Scilab Help,
  5. ATOMS (AuTOmatic Modules Management for Scilab) and
  6. Xcos.

Note:

  1. 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.
  2. 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:

  1. Use mouse to choose Main Menu -> ? -> Scilab Help
  2. Type F1 from the console
  3. 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.
  4. 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.

  1. Scilab commands are case sensitive. the characters A and a are distinct.
  2. To let Scilab console know the command is complete, press the Enter key. Only then does the command get executed.
  3. If you type a command that Scilab does not understand, it will display an error message.
  4. 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:

  1. To clear the screen type the clc <cr> at the command prompt or simply press the F2 key.
  2. To abort a command midway without executing it, press the Esc key on the keyboard.
  3. 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.
  4. 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.

Closing Scilab

You can close Scilab in one of the following ways:

  1. 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.
  2. From the main menu, choose File -> Quit.
  3. Click on the Close button on the Scilab console window.

Screencast

Watch the screencast on YouTube

Task Discussion


  • Anonym   Nov. 7, 2011, 7:40 p.m.

      Suppose you defined  a function.  Does it get erased when you clear the screen or does it remain in the memory?

  • Satish Annigeri   Nov. 7, 2011, 8:02 p.m.
    In Reply To:   Anonym   Nov. 7, 2011, 7:40 p.m.

    Clearing the screen (clc) does not erase the defined function. It only clears the screen. It is more important to know what happens when you quit Scilab.

    If you define a function by typing it at the Scilab console, it is stored in the Scilab workspace and is erased when you quit Scilab.

    An alternate, and better approach, would be to write the function in SciNotes (Console Main Menu -> Applications -> SciNotes), load it into Scilab Workspace (SciNotes Main Menu -> Execute -> with echo) and save the function to a disk file (SciNotes Main Menu -> File -> Save). To execute the function the next time, start Scilab, open SciNotes, load the function file (SciNotes Main Menu -> File -> Open) and load the function into Scilab workspace.

    Regards.

    Satish Annigeri

  • Anonym   May 25, 2011, 4:44 p.m.

    I'm not getting sounds in the video. Is that how its supposed to be?

  • Satish Annigeri   May 25, 2011, 8:44 p.m.
    In Reply To:   Anonym   May 25, 2011, 4:44 p.m.

    Yes, the screencasts have no audio (including the ones in subsequent sessions). Sorry. I have used comments at the end of the commands to indicate what is being done.

  • Antonio Neves   May 24, 2011, 7:39 p.m.

    I liked the Google Summer of Code for Scilab, in the end are these projects open source?

  • Satish Annigeri   May 24, 2011, 7:58 p.m.
    In Reply To:   Antonio Neves   May 24, 2011, 7:39 p.m.

    All projects are open source. See here http://www.google-melange.com/gsoc/projects/list/google/gsoc2011 for the list of all GSOC projects, of which you will see Scilab projects too.

  • Satish Annigeri   May 26, 2011, 11:43 a.m.
    In Reply To:   Antonio Neves   May 24, 2011, 7:39 p.m.

    Yes. Google supports open source through stipends to students who want to work on open source projects under mentorship of developers already wroking on these projects. Visit the following URL for a list of proposals accepted this year: http://www.google-melange.com/gsoc/projects/list/google/gsoc2011