Scilab
Chapter 2. How will we learn about Scilab?
Chapter 2.1 Introduction
The main advantage of the course is the ability to read fragments of text and at the same time check what you have just read on a “live” Scilab. Then you will easily understand the instructions or, more broadly, how the program works. Therefore, the following 2 applications should be running in the background at all times.
Fig.2-1
Left icon – Internet browser (Google Chrome here) with an open Scilab* course
Right icon – the open Scilab application
Note:
The Scilab course and the Scilab application are two different things! Just like sailing course and sailing.
*That is, what you are reading now.
Chapter 2.2 Preparing Scilab to work with the course
That is, Scilab with only the Console and Variable Browser windows open. We will close the remaining windows made of “factory” Scilab (Fig. 1-3, Chapter 1.
Fig.2-2
Setting up the Console and Variable Browser windows
Before turning on the Video button, you see the desired, i.e. final state of Scilab in which:
– the left window is the console where you will test instructions
– the right window is the Variable Browser where you will see how a given instruction modifies its variables.
Nothing more nothing less. There is no better teaching aid!
Individual stages of the video
1. Open Scilab by clicking its icon
2. A “factory new” Scilab will open, i.e. with 5 basic windows.
3. Clicking on the beams of 5 windows. Each of them becomes active – grayed out and the top menu related to that window.
Conclusion: If you want to use e.g. the console, click on the console bar and use the top menu.
4. We close unnecessary windows. Only the Console and Variable Browser will remain. We will continue to use this Scilab.
I advise you to carefully study the individual stages of the video! Even with replays. Remember to always have browser programs with the Course and Scilab open while reading the course. This is not necessary, but it will be easier for you to complete this course.
Chapter 2.3 How to read and test what you have just read?
Thanks to the 2 icons in Fig. 2-1 whose applications should be open, we have all the time access to the Course and Scilab.
Now you can read the Course and test Scilab with two methods
1. Small Course and Scilab windows at the same time –>Chapter 2.4
2. Large Course and Scilab windows alternating –>Chapter 2.5
Choose one of the methods. I used from Chapter 2.4. It is more educational, although it requires better eyesight. And you choose the one that is more convenient for you.
In both methods you copy the instructions for testing. Instead of copying, you can enter instructions manually.
Chapter 2.4 Small Course and Scilab windows at the same time
We will check 2 instructions
x=2–>the instruction writes the number 2 to the variable x. Or more cleverly–>to the variable with address x
disp(x)–>the instruction displays the value of the variable x=2.
In the animation Fig. 2-3 you will see 2 small windows for Course and Scilab side by side. So that you don’t have to keep switching Course/Scilab. Is it an advantage or a disadvantage? Nothing in life is free. You need to have better eyesight because the inscriptions are smaller.
Fig.2-3
Two small windows of the Course and Scilab together – the final state of the animation.
The first half of the animation is setting the Course and Scilab windows next to each other, the second is executing the x=2 and disp(x) instructions.
1. By clicking the icons, we check whether the Course and Scilab applications are running in the background. This is because they open alternately across the entire screen.
2. When the Course window takes up the entire screen, I press the Windows key (aka Winkey, Start, Superkey) at the same time.
and down cursor arrow key ← (move left). The Course Window will take up half of the left screen.
3. In the right half of the screen you will see a reduced Scilab window. Click it and it will take up the entire right half. As a result, you see Scilab and Console windows next to each other. You can now test instructions.
4. In the left window, I copy the x=2 instruction and paste it into the right window to the console in the right window.
5. In the right window I execute the x=2 instruction by clicking Enter. Echo and the Variable Viewer confirmed the execution of the instruction
6. In the left window, I copy the disp(x) statement and paste it in the right window to the console in the right window.
7. In the right window, I execute the disp(x) instruction by clicking Enter. The number 2 was displayed on the console.
Thanks to the so-called echo you see the effect of the instruction. You see the same thing in the variable browser.
Chapter 2.5 Large Course and Scilab windows alternating
We will check the same instructions again
x=2
disp(x)
Fig. 2-4
Two large windows of the Course and Scilab separately – the final state of the animation.
I alternately call Course where I copy the instruction and Scilab where I paste the instruction into the console and execute it.
1. I click Course and copy the x=2 instruction
2. I click Scilab, paste the x=2 instruction and execute it with Enter. You can see the effect in the Variable Browser and in echo on the console.
3. I click on Course and copy the disp(x) instruction. I do it by clicking Enter.
Chapter 2.6 Restoring Scilab to its “factory” state and the clc and clear instructions.
Most often we will use Scilab with the Console and Variable Browser windows. And what if you miss the “factory” Scilab with 5 windows from Fig. 1-3 chapter. 1? Then you will do as in the animation Fig. 2-5. At the same time, you will become familiar with the very important clear and clc instructions.
Fig.2-5
Restoring Scilab to its “factory” state.
1. The animation starts with the initial state, i.e. with the Console and Variable Browser Windows
2. In the Console window, click Edit/Preferences
3. The Desktop Layout window will open
4. Click Reset Layout and confirm
5. I close the Layout window and confirm
6. I close the Scilab window and confirm
7. I’m back in Scilab. It is in “factory” condition, i.e. with 5 windows.
8. In the Console window, I manually enter the x=5 instruction. The x variable data appeared in the Variable Browser window.
9. I manually enter the clear statement and click Enter. x data disappears from Variable Browser.
10. I manually enter the clear statement and click Enter. The Console screen is clearing.