[Top][All Lists]

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

function scope and load

From: Adam Kornick
Subject: function scope and load
Date: 17 May 2001 13:30:38 -0400
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7


I'm trying to port some Matlab code that loads a file of structs and
then returns some of the structs to the calling function.  Loading the
file works fine from the command prompt, but when I call the function
to load the file it returns empty variables. Examples below, not sure
what to do next. Thoughts?

I'm using GNU Octave, version 2.1.33 (i386-redhat-linux-gnu).

`The function does the following

function [const,sat,shallow]=t_getconsts;
if exist('t_constituents.mat');
  load -force "t_constituents.mat" %has structs inside
% do some math to generate the file

`The file can be loaded fine but the variables are lost when I leave
`the scope.
`Global scope from the prompt

>> load -force t_constituents.mat
>> whos

*** local user variables:

prot  type                       rows   cols  name
====  ====                       ====   ====  ====
 rwd  struct                        -      -  const
 rwd  scalar                        1      1  prefer_zero_one_indexing
 rwd  struct                        -      -  sat
 rwd  struct                        -      -  shallow

`but the function won't return anything

>> [const,sat,shallow]=t_getconsts
const = []
sat = []
shallow = []

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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