help-octave
[Top][All Lists]
Advanced

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

Re: (no subject)


From: Doug Stewart
Subject: Re: (no subject)
Date: Fri, 10 Jun 2016 09:08:07 -0400



On Fri, Jun 10, 2016 at 8:57 AM, Lester Anderson <address@hidden> wrote:
On 10 June 2016 at 13:24, Doug Stewart <address@hidden> wrote:
>
>
> On Fri, Jun 10, 2016 at 7:42 AM, Lester Anderson <address@hidden>
> wrote:
>>
>> > %read parameters from a txt file
>> >
>> > [datafile] = uigetfile('*.txt','Choose a txt file');
>> > A=dlmread(datafile);
>> > zt = A(:,1);
>> > zb = A(:,2);
>> > agetop = A(:,3);
>> > agebas = A(:,4);
>> > psed = A(:,5);
>> > c = A(:,6);
>> > surpor = A(:,7);
>> > basset = A(:,8);
>> >
>> > flagfile = 1;
>> > flagunits = 1;
>> > flagage = 1;
>> > flagdens = 1;
>> > flagporo = 1;
>> >
>> > p.s. hope this is posting in the right place now
>>
>> As a double check, I removed the ";" from the line ends to see what is
>> written to the terminal and that all looked fine; it just did not
>> write the variables to the workspace.
>
>
>
> can you post your exact file at bpaste.net
> or some other place so I can see what you actually have.
>
I have attached the function file causing problems and input txt file.
Load and dlmread both work to read a file.



OK all is clear now!

you have written a function file not a script file.

In a function all variables that are defined in the function are local vars.
So A has a scope of just that function, so it will not show up in the 
workspace vars after the function has completed.

remove the   function loparfi
to make it a script file, or make A global



--
DAS


reply via email to

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