Time for action - making your first script
1. Start the Octave interactive environment and open the editor:
octave:1> edit
2. Write the following commands in the editor, but leave out the hash marks (#) and the code line numbers to the right. They are used only for reference:
Code Listing 4.1 A = rand(3,5); #1 #2 min(min(A)) #3
Downloading the example code
Note
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
3. Save the file as
script41.m
(notice the extension.m)
under the current directory or anywhere in the Octave search path directory.4. Now executing the commands in the script file is done by simply typing:
octave:2> script41 ans = 0.1201
What just happened?
In Command 1, we opened the editor and we then wrote two Octave commands. When we ask Octave to execute the text...