Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news-fra1.dfn.de!newsfeed.velia.net!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail
From: Ralph Schleicher <rs@ralph-schleicher.de>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Scope of 'To Workspace' variables
Date: Tue, 27 May 2008 01:21:42 +0200
Organization: Ralph Schleicher, Freelance Engineer
Lines: 36
Message-ID: <87iqx0mz21.fsf@echo.mueller-schleicher.i>
References: <g1ck2e$b5r$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.t-online.com 1211846942 02 24516 OHgcOOsL3uDikHH 080527 00:09:02
X-Complaints-To: usenet-abuse@t-online.de
X-ID: EeIjdaZLwejRl-58sG1PZC9TvQ0R4jI8XogNshqumuRvATtXsCTK8b
X-Face: &_l@,v,={27&f~U1u&T}}@PiTrV\4A7due$J*se+PiDvOWS][xPeQt/3_5MBC6]tT}a;0te%<^Tv]Qog%#OsE;AeVgoye>u/9@!Z`$>v[(=ps'%<XU:rR5C&EGM#$R~mH2[#Z;
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)
Cancel-Lock: sha1:HAypzt3wmrsXmiTJkQm2DMTalXg=
Xref: news.mathworks.com comp.soft-sys.matlab:470489



"Hans Gohle" <ghostryder@gmx.de> writes:

> I have a model that contains several 'To Workspace' outputs.
> The execution of the model is done within a function and
> therefore these variables are only visible within that
> function. 
>
> But I need all these variables in the workspace as they are
> needed by a GUI that is executed concurrently and plots the
> data from the model. What is the best way to share the data
> between the model and the GUI?

Do you look for somethink like that:


function a_function
  sim('a_model');
  % Propagate workspace variables.
  my_gui('sim-data', a, b, c);


function my_gui(varargin)
  switch varargin{1}
   case 'sim-data'
    a = varargin{2};
    b = varargin{3};
    c = varargin{4};
  end


-- 
Ralph Schleicher, Freelance Engineer    http://ralph-schleicher.de

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools