Difference between revisions of "Scilab/C2/Scripts-and-Functions/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with ' {| Border=1 || Time || Narration |- |00.02 | | Welcome to the spoken tutorial on Scripts and Functions with Scilab. |- | 00.07 | | Let us start with a brief introducti…')
 
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{| border = 1
  
 +
|'''Time'''
  
{| Border=1
+
|'''Narration'''
 
+
|| Time
+
 
+
|| Narration
+
 
+
  
 
|-
 
|-
 
+
| 00:01
|00.02
+
|Welcome to the spoken tutorial on '''Scripts and Functions''' with Scilab.  
 
+
| | Welcome to the spoken tutorial on Scripts and Functions with Scilab.
+
  
 
|-
 
|-
 
+
| 00:06
| 00.07
+
|Let us start with a brief introduction to the '''file formats''' in Scilab.  
 
+
| | Let us start with a brief introduction to the file formats in Scilab.
+
  
 
|-
 
|-
 
+
| 00:12
|00.12
+
|When several commands are to be executed, it may be more convenient to write these statements into a file with the Scilab editor.  
 
+
| | When several commands are to be executed, it may be more convenient to write these statements in to a file with Scilab editor.
+
  
 
|-
 
|-
 
+
| 00:21
|00.22
+
|These are called as SCRIPT files.  
 
+
| | These are called SCRIPT files.
+
  
 
|-
 
|-
 
+
| 00:24
|00.25
+
|To execute the commands written in such a script file, the '''exec''' function can be used followed by the name of the script file.
 
+
| | To execute the commands written in such a script file,the exec function can be used, followed by the name of the script file
+
  
 
|-
 
|-
 
+
| 00:34
| 00.35
+
|These files generally have the extension '''.sce''' or '''.sci''', depending on its content.  
 
+
| | These file generally have the extension dot sce or dot sci, depending on its content.
+
  
 
|-
 
|-
 
+
| 00:42
| 00.43
+
| Files having the '''.sci''' extension contain Scilab function and or user defined functions.  
 
+
|| Files having the dot sci extension contain scilab function and or user defined function.
+
  
 
|-
 
|-
 
+
| 00:51
|00.52
+
|Executing these files loads the functions into Scilab environment (but does not execute them), whereas
 
+
| | Executing these files loads the functions into Scilab environment (but does not execute them),
+
  
 
|-
 
|-
 
+
| 01:00
|00.59
+
| files having the '''.sce''' extension contain Scilab function and User defined functions.
 
+
| | whereas
+
  
 
|-
 
|-
 
+
| 01:08
|01.02
+
|Please remember that the convention of naming the extension as .sce and .sci are not rules but a convention followed by the scilab community.  
 
+
| | Files having the dot sce extension contain Scilab function and user defined function.
+
  
 
|-
 
|-
 
+
|01:21
| 01.09
+
|Let us open Scilab console window on the computer.  
 
+
| | Please remember that the convention of naming the extension as dot sce and dot sci are not RULES, but a convention followed by the scilab community.
+
  
 
|-
 
|-
 
+
|01:27
|01.22
+
|Check on the present working directory by typing the command '''pwd''' on the command prompt.  
 
+
| | Let us open the Scilab Console window on the computer.
+
  
 
|-
 
|-
 
+
| 01:35
|01.28
+
|Go to the Task bar of scilab console window and click on Editor option to open the scilab editor.
 
+
| | On the present working directory by typing the command pwd on the command prompt
+
  
 
|-
 
|-
 
+
| 01:49
| 01.36
+
|I have already typed the commands in a file and saved it as helloworld.sce, therefore I will open that file using Open a file shortcut icon.
 
+
| Go to the Task bar of scilab console window and click on the editor option to Open the scilab editor
+
  
 
|-
 
|-
 
+
| 02:03
| 01.50
+
|Select helloworld.sce file and click on Open.
 
+
| I have already typed the commands in a file and saved it as helloworld.sce,
+
  
 
|-
 
|-
 
+
| 02:10
|01.56
+
|You may type the commands in the new file and save this file to the current working directory as helloworld.sce through the File menu.  
 
+
| | Therefore I will open that file using Open a file shortcut icon.
+
  
 
|-
 
|-
 
+
| 02:20
|02.04
+
|Go to Execute button on the scilab editors menu bar and select Load into Scilab option.  
 
+
| | Select helloworld.sce file and click on open.
+
  
 
|-
 
|-
 
+
|02:29
|02.11
+
|This will load the file into  scilab console.  
 
+
| | You may type the commands in the new file and save this file to the current working directory as helloworld.sce through the file menu.
+
  
 
|-
 
|-
 
+
|02:34
|02.20
+
|After loading the file on the console the script produces the output as you see.  
 
+
| | Go to the execute button on the scilab editors menu bar and select load into scilab option.
+
  
 
|-
 
|-
 
+
|02:43
|02.30
+
|It contains both the commands and the resulting output for the respective commands.
 
+
| | This will load the file into the scilab console.
+
  
 
|-
 
|-
 
+
|02:49
|02.35
+
|Now change the value of a to 1.  
 
+
| | After loading the file on the console the script produces the output as you see.
+
  
 
|-
 
|-
 
+
|02:55
|02.43
+
|In the editor, go to the File menu and click on Save.
 
+
| | It contains both the commands and the resulting output for the respective command.
+
  
 
|-
 
|-
 
+
| 03:02
|02.49
+
|We can also execute the script directly from the scilab interpreter using the '''exec''' command and giving the path to the script file as:
 
+
|| Now change the value of a to 1.
+
  
 
|-
 
|-
 
+
| 03:12
|02.55
+
| exec into brackets into double quotes helloworld.sce, that is the file name, and press Enter.
 
+
| | In the editor go to the file menu and click save.
+
  
 
|-
 
|-
 
+
| 03:31
|03.02
+
| The script file produces a similar output with the use of '''exec''' function.
 
+
|| We can also execute this script directly from the scilab interpretor using the exec command
+
  
 
|-
 
|-
 
+
| 03:37
|03.09
+
| Let us now talk about '''functions'''.  
 
+
| | And giving the path to the script file as exec into brackets into double quotes helloworld.sce that is the file name and press enter.
+
  
 
|-
 
|-
 
+
| 03:39
|03.32
+
|A function definition starts with the keyword '''function''' and ends with the keyword '''endfunction'''.  
 
+
| | The script file produces a similar output with the use exec function.
+
  
 
|-
 
|-
 
+
| 03:46
| 03.37
+
| I have already saved a function file in function.sci, using the scilab editor.
 
+
| | Let us now talk about Functions:
+
  
 
|-
 
|-
 
+
| 03:57
|03.40
+
|I will open that file.
 
+
| | A function definition starts with the keyword function and ends with the keyword endfunction.
+
  
 
|-
 
|-
 
+
| 04:03
| 03.47
+
|As you see, the function is defined here.
 
+
| | I have already saved a function file in function.sci using the scilab editor.
+
  
 
|-
 
|-
 
+
| 04:08
|03.57
+
|In these, '''degrees''' is the output parameter and '''radians''' is the input parameter.
 
+
| | I will open that file as you see
+
  
 
|-
 
|-
 
+
| 04:21
|04.05
+
|To the function name '''radians2degrees'''.
 
+
| | The function is defined here.
+
  
 
|-
 
|-
 
+
| 04:26
| 04.09
+
|I will  load this function in Scilab, using the Execute menu option.  
 
+
| | In this degrees is the output parameter and radians is the input parameter to the function named radians2degrees.
+
  
 
|-
 
|-
 
+
| 04:40
|04.26
+
| The function is now loaded in the scilab console.  
 
+
| | I will load this function in Scilab using the Execute menu option.
+
  
 
|-
 
|-
 
+
| 04:44
|04.40
+
|It can also be loaded using the '''exec''' command.
 
+
| | The function is now loaded in the scilab console.
+
  
 
|-
 
|-
 
+
| 04:47
| 04.45
+
|Once a function is loaded, it can be called like any other Scilab function by passing specific arguments to that function.
 
+
| It can also be loaded using exec command
+
  
 
|-
 
|-
 
+
| 04:56
| 04.48
+
|Make a mental note of the percent sign (%) and recall the reason of its use.  
 
+
| | Once a function is loaded, it can be called like any other Scilab function by passing specific arguments to that function.
+
  
 
|-
 
|-
 
+
| 05:02
| 04.56
+
|Now let us find values for radians2degrees of %pi/2 and radians2degrees of (%pi/4).  
 
+
|| Make a mental note of the% sign and recall the reason for its use.
+
  
 
|-
 
|-
 
+
| 05:17
|05.02
+
|percent pi/2 and radians2degrees percent pi by 4 (%pi/4).  
 
+
|| Now let us find values for radians2degrees of %pi by 2 and radians2degrees of %pi by 4.
+
  
 
|-
 
|-
 
+
| 05:28
|05.17
+
|Now we will see a function with more than one input and output arguments.
 
+
|| %pi by 2 and radians2degrees of %pi by 4
+
  
 
|-
 
|-
 
+
| 05:33
|05.28
+
|This function will take '''polar coordinates''' as input argument and returns '''rectangular coordinates''' as output arguments.  
 
+
| | Now we will see a function with more than one input and output arguments.
+
  
 
|-
 
|-
 
+
| 05:44
|05.34
+
|I will open the file which I have already typed.
 
+
| | This function will takes polar coordinates as input argument and returns rectangular coordinates as output argument.
+
  
 
|-
 
|-
 
+
| 05:51
| 05.45
+
|Here you can see, '''x''' and '''y''' are the output parameters and '''r''' and '''theta''' are the input parameters to the function '''polar2rect'''.
 
+
| | I will open the file which I have already typed.
+
  
 
|-
 
|-
 
+
| 06:06
|05.52
+
|I will  load this function in scilab using the '''exec''' option.
 
+
| | Here you can see x and Y are the output parameters and r and theta are the input parameters to the function polar2rec.
+
  
 
|-
 
|-
 
+
| 06:21
|06.06
+
|Once the function is loaded, we need to call the function. This function requires two input arguments and two output arguments.  
 
+
| | I will load this function in scilab using the exec option.
+
  
 
|-
 
|-
 
+
| 06:31
| 06.22
+
|Therefore r = 2,
 
+
| | Once the function is loaded, we need to call the function.
+
  
 
|-
 
|-
 
+
| 06:37
|06.25
+
|theta = 45;
 
+
| | This function requires two input arguments and two output arguments.
+
  
 
|-
 
|-
 
+
| 06:44
|06.32
+
|and now we will call it x1 comma y1, output parameters, is equal to function name '''polar2rect into bracket r comma theta''' and press Enter.
 
+
| | Therefore r is equal to 2 , theta is equal to 45 and now we will call it x1,y1 output parameters is equal to function name polar to rect into bracket r comma theta and press enter.
+
  
 
|-
 
|-
 
+
| 07:25
|07.25
+
|You will see the value of x1 and y1.
 
+
| | You will see the values of x1 and y1
+
  
 
|-
 
|-
 
+
| 07:29
| 07.30
+
|One of the interesting features of Scilab is, you can define any number of functions in a single '''.sci''' file.  
 
+
|| One of the interesting features of Scilab is you can define any number of functions in a single .sci file.
+
  
 
|-
 
|-
 
+
| 07:38
|07.38
+
|While doing this, please remember that by default all the variables defined in a function are local, the scope of these variables used in a particular function ends with the '''endfunction''' keyword of the function definition.
 
+
| | While doing this please remember that by default all the variables defined in a function are local
+
  
 
|-
 
|-
 
+
| 07:55
|07.46
+
|Advantage of this feature is that, we can use same variable names in different function.
 
+
| | The scope of variables used in a particular function ends with the endfunction keyword of the function definition
+
  
 
|-
 
|-
 
+
| 08:05
| 07.56
+
|These variables won't get mixed up unless we use the global option.  
 
+
| | Advantage of this feature is that we can use same variable names in different function.
+
  
 
|-
 
|-
 
+
| 08:10
|08.06
+
|To know more about the global variables, type '''help global'''.  
 
+
| | These variables won't get mixed up unless we use the global option.
+
  
 
|-
 
|-
 
+
| 08:18
| 08.11
+
|Please note that if any variable is to be "watched" or monitored inside a function then '''disp''' is required.  
 
+
|| To know more about the global variable type help global.
+
  
 
|-
 
|-
 
+
| 08:26
| 08.19
+
|Inside a function file, you can check for yourself the effect of putting a semicolon ( ; ) at the end of a statement.  
 
+
|| Please note that if any variable is to be "watched" or monitored inside a function, then disp is required.
+
  
 
|-
 
|-
 
+
| 08:34
| 08.27
+
|Also check this for '''disp''' statements.  
 
+
| | Inside a function file, you can check for yourself the effect of putting a semicolon ( ; ) at the end of a statement.
+
  
 
|-
 
|-
 
+
| 08:38
|08..35
+
|'''Inline Functions''': Functions are segments of code that have well defined input and output as well as local variables.  
 
+
| | Also check this for disp("...") statements.
+
  
 
|-
 
|-
 
+
| 08:46
| 08.38
+
|The simplest way to define a function  is by using the command `'''deff'''. 
 
+
| | Inline Functions:
+
  
 
|-
 
|-
 
+
| 08:53
|08.40
+
|Scilab allows the creation of in-line functions and are especially useful when the body of the function is short.
 
+
| | Functions are segments of code that have well defined input and output as well as local variables.
+
  
 
|-
 
|-
 
+
| 09:02
|08.47
+
|This can be done with the help of the function deff().  
 
+
| | The simplest way to define a function is by using the command `deff'.
+
  
 
|-
 
|-
 
+
| 09:07
| 08.54
+
|It takes two string parameters.  
 
+
| | Scilab allows the creation of in-line functions and are especially useful when the body of the function is short.
+
  
 
|-
 
|-
 
+
| 09:10
|09.03
+
|The first string defines the interface to the function and the second string defines the statements of the function.  
 
+
| | This can be done with the help of the function deff().
+
  
 
|-
 
|-
 
+
| 09:19
|09.07
+
|The '''deff''' command defines the function in the Scilab and also loads it.
 
+
| | It takes two string parameters.
+
  
 
|-
 
|-
 
+
| 09:26
|09.10
+
|There is no need to load the function defined by using '''deff''' command explicitly through execute menu option .
 
+
| | The first string defines the interface to the function.
+
  
 
|-
 
|-
 
+
| 09:34
|09.14
+
|Let us see an example to illustrate this concept:
 
+
| | The second string defines the statements of the function.
+
  
 
|-
 
|-
 
+
| 09:41
|09.20
+
|I will open a file '''inline.sci''' where I have written the inline function.
 
+
| | The deff command defines the function in Scilab and also loads it.
+
  
 
|-
 
|-
 
+
| 09:51
|09.27
+
|I will resize the editor window.
 
+
| | There is no need to load the function defined by using deff command explicitly through execute menu option.
+
  
 
|-
 
|-
 
+
| 09:57
| 09.35
+
|As mentioned earlier, the first string defines the function declaration and the second string defines the statements of the function.  
 
+
| | Let us see an example to illustrate this concept.
+
  
 
|-
 
|-
 
+
| 10:13
|09.41
+
|We will load this function in Scilab editor and use it to find the values of degrees2radians of 90 and degrees2radians of 45.  
 
+
| | Iwill open a file inline.sci where I have written the inline function.
+
  
 
|-
 
|-
 
+
| 10:54
|09.52
+
|A function should call, not just other functions within itself, but also '''itself'''.  
 
+
| | I will resize the editor window:
+
  
 
|-
 
|-
 
+
| 11:00
| 09.57
+
|This is '''recursive''' calling of a function.  
 
+
| As mentioned earlier the first string defines the function declaration and the second string defines the statements of the function.
+
  
 
|-
 
|-
 
+
| 11:03
|10.14
+
|This is required, for example, when writing a function to calculate the factorial of an integer.
 
+
| | We will load this function in scilab editor and
+
  
 
|-
 
|-
 
+
| 11:10
|10.25
+
|Let us extend the discussion on file formats in Scilab:
 
+
| Use it to find the values of degrees2radians of 90 and degrees2radians of 45.
+
  
 
|-
 
|-
 
+
| 11:14
| 10.55
+
|As mentioned earlier Scilab uses two types of file formats, namely the '''.sce''' file format and the '''.sci''' file formats.  
 
+
| | A function should call, not just other functions within itself, but also ITSELF.
+
  
 
|-
 
|-
 
+
| 11:23
|11.01
+
|The files with the '''.sce''' file extension are the script files which contain the Scilab commands that you enter during an interactive kind of Scilab session.  
 
+
| | This is "recursive" calling of a function.
+
  
 
|-
 
|-
 
+
| 11:35
|11.03
+
|They can comprise comment lines utilized in documenting the function and they can also use the command '''exec''' to execute the script.  
 
+
| | This is required, for example, when writing a function to calculate the factorial of an integer.
+
  
 
|-
 
|-
 
+
| 11:52
| 11.11
+
|The files with the '''.sci''' file extension are the function files that start with the function statement.
 
+
|| Let us extend the discussion on file formats in Scilab:
+
  
 
|-
 
|-
 
+
| 12:00
|11.14
+
|A single '''.sci''' file can have multiple function definitions which themselves contain any number of Scilab statements, that perform operations on the function arguments or on the output variables, after they have been evaluated.  
 
+
| | As mentioned earlier SCILAB uses two types of file formats, namely the SCE file format and the SCI file format.
+
  
 
|-
 
|-
 
+
| 12:20
|11.24
+
|This brings us to the end of this spoken tutorial on '''Scripts and Functions''' in Scilab.
 
+
| | The files with the dot sce file extension are the script files,
+
  
 
|-
 
|-
 
+
| 12:25
|11.28
+
|There are many other functions in Scilab which will be covered in other spoken tutorials.  
 
+
| | which contain the SCILAB commands that you enter during an interactive kind of SCILAB session.
+
  
 
|-
 
|-
 
+
| 12:31
|11.36
+
|Keep watching the Scilab links.  
 
+
| | They can comprise comment lines utilized in documenting the function and they can also use the command EXEC to execute the script.
+
  
 
|-
 
|-
 
+
| 12:33
|11.53
+
|This spoken tutorial: has been created by the Free and Open Source Software in Science and Engineering Education (FOSSEE).
 
+
| | The files with the dot sci file extension are the function files that start with the function statement.
+
  
 
|-
 
|-
 
+
| 12:40
|12.00
+
|More information on the FOSSEE project could be obtained from http://fossee.in or http://scilab.in
 
+
| | A single dot sci file can have multiple function definitions which themselves contain any number of SCILAB statements that perform operations on the function argument,
+
  
 
|-
 
|-
 
+
| 12:50
|12.15
+
|Supported by the National Mission on Eduction through ICT, MHRD, Government of India.
 
+
| | or on the output variables after they have been evaluated.
+
  
 
|-
 
|-
 
+
| 12:56
| 12.21
+
|For more information, visit: http://spoken-tutorial.org/NMEICT-Intro.  
 
+
| | This brings us to the end of this spoken tutorial on Scripts and Functions in Scilab.
+
  
 
|-
 
|-
 
+
| 13:06
|12.26
+
|This is Anuradha Amrutkar from IIT Bombay. signing off.  
 
+
| | There are many other functions in Scilab which will be covered in other spoken tutorials.
+
  
 
|-
 
|-
 
+
| 13:10
|12.31
+
|Thanks for joining us. Goodbye.
 
+
| | Keep watching the Scilab links.
+
 
+
|-
+
 
+
| 12.34
+
 
+
| '''This spoken tutorial has been created by the Free and Open Source Software in Science and Engineering Education (FOSSEE).'''
+
 
+
|-
+
 
+
|12.42
+
 
+
| | '''More information on the FOSSEE project could be obtained from http://fossee.in or http://scilab.in'''
+
 
+
|-
+
 
+
|12.51
+
 
+
| | '''Supported by the National Mission on Eduction through ICT, MHRD, Government of India.'''
+
 
+
|-
+
 
+
|12.57
+
 
+
| | '''For more information, visit:spoken hyphen tutorial dot o r g slash NMEICT hyphen intro'''
+
 
+
[http://spoken-tutorial.org/NMEICT-Intro]
+
 
+
|-
+
 
+
|13.07
+
 
+
| | '''This is Anuradha Amrutkar from IIT Bombay signing off.
+
 
+
|-
+
 
+
|13.11
+
 
+
| | Thanks for joining us.'Good bye''
+
 
+
|}
+

Latest revision as of 11:31, 7 November 2017

Time Narration
00:01 Welcome to the spoken tutorial on Scripts and Functions with Scilab.
00:06 Let us start with a brief introduction to the file formats in Scilab.
00:12 When several commands are to be executed, it may be more convenient to write these statements into a file with the Scilab editor.
00:21 These are called as SCRIPT files.
00:24 To execute the commands written in such a script file, the exec function can be used followed by the name of the script file.
00:34 These files generally have the extension .sce or .sci, depending on its content.
00:42 Files having the .sci extension contain Scilab function and or user defined functions.
00:51 Executing these files loads the functions into Scilab environment (but does not execute them), whereas
01:00 files having the .sce extension contain Scilab function and User defined functions.
01:08 Please remember that the convention of naming the extension as .sce and .sci are not rules but a convention followed by the scilab community.
01:21 Let us open Scilab console window on the computer.
01:27 Check on the present working directory by typing the command pwd on the command prompt.
01:35 Go to the Task bar of scilab console window and click on Editor option to open the scilab editor.
01:49 I have already typed the commands in a file and saved it as helloworld.sce, therefore I will open that file using Open a file shortcut icon.
02:03 Select helloworld.sce file and click on Open.
02:10 You may type the commands in the new file and save this file to the current working directory as helloworld.sce through the File menu.
02:20 Go to Execute button on the scilab editors menu bar and select Load into Scilab option.
02:29 This will load the file into scilab console.
02:34 After loading the file on the console the script produces the output as you see.
02:43 It contains both the commands and the resulting output for the respective commands.
02:49 Now change the value of a to 1.
02:55 In the editor, go to the File menu and click on Save.
03:02 We can also execute the script directly from the scilab interpreter using the exec command and giving the path to the script file as:
03:12 exec into brackets into double quotes helloworld.sce, that is the file name, and press Enter.
03:31 The script file produces a similar output with the use of exec function.
03:37 Let us now talk about functions.
03:39 A function definition starts with the keyword function and ends with the keyword endfunction.
03:46 I have already saved a function file in function.sci, using the scilab editor.
03:57 I will open that file.
04:03 As you see, the function is defined here.
04:08 In these, degrees is the output parameter and radians is the input parameter.
04:21 To the function name radians2degrees.
04:26 I will load this function in Scilab, using the Execute menu option.
04:40 The function is now loaded in the scilab console.
04:44 It can also be loaded using the exec command.
04:47 Once a function is loaded, it can be called like any other Scilab function by passing specific arguments to that function.
04:56 Make a mental note of the percent sign (%) and recall the reason of its use.
05:02 Now let us find values for radians2degrees of %pi/2 and radians2degrees of (%pi/4).
05:17 percent pi/2 and radians2degrees percent pi by 4 (%pi/4).
05:28 Now we will see a function with more than one input and output arguments.
05:33 This function will take polar coordinates as input argument and returns rectangular coordinates as output arguments.
05:44 I will open the file which I have already typed.
05:51 Here you can see, x and y are the output parameters and r and theta are the input parameters to the function polar2rect.
06:06 I will load this function in scilab using the exec option.
06:21 Once the function is loaded, we need to call the function. This function requires two input arguments and two output arguments.
06:31 Therefore r = 2,
06:37 theta = 45;
06:44 and now we will call it x1 comma y1, output parameters, is equal to function name polar2rect into bracket r comma theta and press Enter.
07:25 You will see the value of x1 and y1.
07:29 One of the interesting features of Scilab is, you can define any number of functions in a single .sci file.
07:38 While doing this, please remember that by default all the variables defined in a function are local, the scope of these variables used in a particular function ends with the endfunction keyword of the function definition.
07:55 Advantage of this feature is that, we can use same variable names in different function.
08:05 These variables won't get mixed up unless we use the global option.
08:10 To know more about the global variables, type help global.
08:18 Please note that if any variable is to be "watched" or monitored inside a function then disp is required.
08:26 Inside a function file, you can check for yourself the effect of putting a semicolon ( ; ) at the end of a statement.
08:34 Also check this for disp statements.
08:38 Inline Functions: Functions are segments of code that have well defined input and output as well as local variables.
08:46 The simplest way to define a function is by using the command `deff.
08:53 Scilab allows the creation of in-line functions and are especially useful when the body of the function is short.
09:02 This can be done with the help of the function deff().
09:07 It takes two string parameters.
09:10 The first string defines the interface to the function and the second string defines the statements of the function.
09:19 The deff command defines the function in the Scilab and also loads it.
09:26 There is no need to load the function defined by using deff command explicitly through execute menu option .
09:34 Let us see an example to illustrate this concept:
09:41 I will open a file inline.sci where I have written the inline function.
09:51 I will resize the editor window.
09:57 As mentioned earlier, the first string defines the function declaration and the second string defines the statements of the function.
10:13 We will load this function in Scilab editor and use it to find the values of degrees2radians of 90 and degrees2radians of 45.
10:54 A function should call, not just other functions within itself, but also itself.
11:00 This is recursive calling of a function.
11:03 This is required, for example, when writing a function to calculate the factorial of an integer.
11:10 Let us extend the discussion on file formats in Scilab:
11:14 As mentioned earlier Scilab uses two types of file formats, namely the .sce file format and the .sci file formats.
11:23 The files with the .sce file extension are the script files which contain the Scilab commands that you enter during an interactive kind of Scilab session.
11:35 They can comprise comment lines utilized in documenting the function and they can also use the command exec to execute the script.
11:52 The files with the .sci file extension are the function files that start with the function statement.
12:00 A single .sci file can have multiple function definitions which themselves contain any number of Scilab statements, that perform operations on the function arguments or on the output variables, after they have been evaluated.
12:20 This brings us to the end of this spoken tutorial on Scripts and Functions in Scilab.
12:25 There are many other functions in Scilab which will be covered in other spoken tutorials.
12:31 Keep watching the Scilab links.
12:33 This spoken tutorial: has been created by the Free and Open Source Software in Science and Engineering Education (FOSSEE).
12:40 More information on the FOSSEE project could be obtained from http://fossee.in or http://scilab.in
12:50 Supported by the National Mission on Eduction through ICT, MHRD, Government of India.
12:56 For more information, visit: http://spoken-tutorial.org/NMEICT-Intro.
13:06 This is Anuradha Amrutkar from IIT Bombay. signing off.
13:10 Thanks for joining us. Goodbye.

Contributors and Content Editors

Gaurav, Krupali, PoojaMoolya, Sandhya.np14, Sneha