How do I open scripts in octave?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I open scripts in octave?

nathvi
Hello, I am in a machine learning class, and I know absolutely nothing about octave. I have these files, and they are in the correct load dirrectory, but when I try to open the file it gives me the error:

"  unable to extract matrix size from file `warmUpExercise.m'     "

The warm up exercise looks like this:

function A = warmUpExercise()
%WARMUPEXERCISE Example function in octave
%   A = WARMUPEXERCISE() is an example function that returns the 5x5 identity matrix

A = [];
% ============= YOUR CODE HERE ==============
% Instructions: Return the 5x5 identity matrix
%               In octave, we return values by defining which variables
%               represent the return values (at the top of the file)
%               and then set them accordingly.


eye (5)




% ===========================================


end







Reply | Threaded
Open this post in threaded view
|

Re: How do I open scripts in octave?

Laurent Hoeltgen
On 23/12/12 19:12, nathvi wrote:

> Hello, I am in a machine learning class, and I know absolutely nothing about
> octave. I have these files, and they are in the correct load dirrectory, but
> when I try to open the file it gives me the error:
>
> "  unable to extract matrix size from file `warmUpExercise.m'"
>
> The warm up exercise looks like this:
>
> function A = warmUpExercise()
> %WARMUPEXERCISE Example function in octave
> %   A = WARMUPEXERCISE() is an example function that returns the 5x5
> identity matrix
>
> A = [];
> % ============= YOUR CODE HERE ==============
> % Instructions: Return the 5x5 identity matrix
> %               In octave, we return values by defining which variables
> %               represent the return values (at the top of the file)
> %               and then set them accordingly.
>
>
> eye (5)
>
>
>
>
> % ===========================================
>
>
> end
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://octave.1599824.n4.nabble.com/How-do-I-open-scripts-in-octave-tp4648322.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave
>

Hi,

can you tell us what you entered in octave?
Btw, if you want the function to return the identity matrix, change the
line after the last comment to:

A = eye(5);

and not just eye(5).

Regards,
Laurent
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: How do I open scripts in octave?

eem2314
In reply to this post by nathvi


On Sun, Dec 23, 2012 at 10:12 AM, nathvi <[hidden email]> wrote:
Hello, I am in a machine learning class, and I know absolutely nothing about
octave. I have these files, and they are in the correct load dirrectory, but
when I try to open the file it gives me the error:

"  unable to extract matrix size from file `warmUpExercise.m'     "

The warm up exercise looks like this:

function A = warmUpExercise()
%WARMUPEXERCISE Example function in octave
%   A = WARMUPEXERCISE() is an example function that returns the 5x5
identity matrix

A = [];
% ============= YOUR CODE HERE ==============
% Instructions: Return the 5x5 identity matrix
%               In octave, we return values by defining which variables
%               represent the return values (at the top of the file)
%               and then set them accordingly.


eye (5)




% ===========================================


end











--
View this message in context: http://octave.1599824.n4.nabble.com/How-do-I-open-scripts-in-octave-tp4648322.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave

to run the script simply type the name of the script (without the .m) at the
octave prompt:

octave:1> warmUpExercise

and you should see

ans =

Diagonal Matrix

      1     0     0     0     0
      0     1     0     0     0
      0     0     1     0     0
      0     0     0     1     0
      0     0     0     0     1


--
Ed Meyer

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: How do I open scripts in octave?

Jordi Gutiérrez Hermoso-2
In reply to this post by nathvi
On 23 December 2012 13:12, nathvi <[hidden email]> wrote:
> Hello, I am in a machine learning class, and I know absolutely nothing about
> octave.

    http://wiki.octave.org/FAQ#How_do_I_execute_an_Octave_script.3F

HTH,
- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave