help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loading dont work


From: James Sherman Jr.
Subject: Re: loading dont work
Date: Tue, 18 Sep 2007 13:10:15 -0400

I think you're confusing data files, scripts and functions.  Your BB.m
file is a function, so when you type BB in the octave prompt, it will
execute the function and return  (you don't have a return value, so it
won't actually return anything).  All the variables in the function
file are in the scope of function and "disappear" when the function
returns.

What I think you are shooting for is just a script that defines C and
D, which you can do by just deleting the line in BB.m that starts with
"function".  This will be just as if you typed those lines into the
octave prompt.

Furthermore, the function "load" is used when you are working with
data files that are either the result of the "save" function or
generated by an outside program that you wish to read into a variable
in octave.

So, long story short either:
a) make BB.m a script by deleting the "function BB" line
or
b) make BB.m a function that returns C and D by replacing the first
line of BB.m:
function [C,D] = BB()
and calling BB in BB2.m in this manner (instead of the "load" line):
[C,D] = BB;

Hope this helps.

James

On 9/18/07, Oscar Bayona Candel <address@hidden> wrote:
>
>  I sorry about agin this silly question but I don´t now why I can´t.
>
>  I save a octave file
>
>  Call BB.m
>
>  with this code
>
>  %%%%%%%%%%%%%%%%
>
>  function BB
>
>  C=[1;1]
>
>  D=[2;2]
>
>  %%%%%%%%%%%%%%%%
>
>
>  And then in other file function BB2, I put
>
>
>  %%%%%%%%%%%%%%%%%%%
>
>
>  function BB2
>
>  load BB
>
>  C+D
>
>  %%%%%%%%%%%%
>
>
>
>  when I execute this BB2 it comes this message....error load enable to find
> file BB
>
>  but the file is there?
>
>
>  I thought it was a virus but it isn´t I have tried and I know it should be
> easy...so if you don´t mind and if you can can you help me please?
>
>  Thanks a lot and sorry about this begginer doubt but I can´t resolve....
>
>
>
>
>
>
> ________________________________
> Busca desde cualquier página Web con una protección excepcional. Consigue la
> Barra de herramientas de Windows Live hoy mismo y GRATUITAMENTE. Pruébalo
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]