Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

global scope
Matlab globals are normally accessible from the command line and all functio
ns.

Is it possible to stay in the interactive environment (ie, m files), but
restrict the scope of globals to the functions within a file, so they are no
t
accessible from the base workspace?

thanks

ross


Report this thread to moderator Post Follow-up to this message
Old Post
ross
05-30-05 01:58 AM


Re: global scope
ross wrote:
>
>
> Matlab globals are normally accessible from the command line and
> all functions.
>
> Is it possible to stay in the interactive environment (ie, m
> files), but
> restrict the scope of globals to the functions within a file, so
> they are not
> accessible from the base workspace?
>
> thanks
>
> ross

No but, nested function "share" by reference the variables defined in
the outer function. See "Scott and Doug's Pick of the W", <http://www.mathworks
.com/matlabcentral/pick/>

/ per

Report this thread to moderator Post Follow-up to this message
Old Post
per isakson
05-30-05 01:58 AM


Re: global scope
"Is it possible to stay in the interactive environment (ie, m files),
but
restrict the scope of globals to the functions within a file, so they
are not
accessible from the base workspace? "

Try declaring the variables 'persistent' in the file with the
functions.

Bob


Report this thread to moderator Post Follow-up to this message
Old Post
metiche
05-30-05 01:58 AM


Re: global scope
"metiche" <ayduda@usa.com> wrote:

>Try declaring the variables 'persistent' in the file with the
>functions.
>
>Bob

Should that work in R13?  I can't seem to get it to work ... maybe I'm just
dim.  Documentation doesn't mention that use of 'persistent' as far as I can
see.

ross



Report this thread to moderator Post Follow-up to this message
Old Post

05-31-05 01:59 AM


Re: global scope
In article <d7fstu$7r2$1@arachne.labyrinth.net.au>, ross@nospam.com
says...
> "metiche" <ayduda@usa.com> wrote:
> 
>
> Should that work in R13?  I can't seem to get it to work ... maybe I'm jus
t
> dim.  Documentation doesn't mention that use of 'persistent' as far as I c
an
> see.
>
> ross
>
>
>

persistent is a part of the R13 language.  It's scope is on a function
basis -- not by file.

--Loren

Report this thread to moderator Post Follow-up to this message
Old Post
Loren Shure
05-31-05 09:05 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Matlab archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:34 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.