|
Less elegant than urs' solution, but quite easy to do, you can use global variables to share between workspaces. I sometimes do that to provide input/output to/from a GUI.
% In some workspace
global MYDATA
MYDATA = 10;
% In a GUI function, say the openingFcn
function [blah] = openingFcn(blah)
% Declare that you want access to that global variable
global MYDATA
% Use the global variable. It's wise to make a local copy of it so that other programs can't mess with your GUI
handles.local_mydata = MYDATA;
More generally (not really for GUIs but useful for subfunctions) You can use the concept of nested functions to share workspaces between functions.
wapo <apostolos1975@gmail.com> wrote in message <c6e68a82-b843-47bf-ad37-2ed3dcc5f731@r38g2000yqn.googlegroups.com>...
> Hi all,
>
> I have a rather theoretical question. I have two workspaces (due to
> GUI) that I am building. In order to share data between different
> objects of the GUI I currently write some data in the base workspace
> (with assignin) and then read that data from another objects workspace
> (evalin). I was wondering if its possible to use the data from the
> base workspace without making a local copy first. For example I have a
> matrix in base. Can I call a plot from a different workspace using the
> data for the matrix from the base.
>
> thanks in advance
>
> Apostolos
|