HELP PLEASE
Is it possible to have a function that reads specific values
from the workspace, even though these values are always
changing?
And when these values change the function updates its values
also
Thank you
plim <manuela.cotrim@gmail.com> wrote in message
<1e392b5f-2ba0-485f-b913-6d2b2fb6d2f3@k37g2000hsf.googlegroups.com>...
> what do you mean with workspace?
Are you serious?
check your matlab main window, its a small box that has all
your variables in your current directory.
for example you might declare x=5; in your code you will see
it as x=5 in your workspace and if you type x in your
command window you will get 5
i dont know why i am telling you this if you dont know
workspace how would you help me
"Rami AbouSleiman" <rdabousl@oakland.edu> wrote in message
<fuaobd$hbu$1@fred.mathworks.com>...
> HELP PLEASE
> Is it possible to have a function that reads specific values
> from the workspace, even though these values are always
> changing?
> And when these values change the function updates its values
> also
You could declare the variable as "global".
Anyway, global variable and accessing/sharing variables
between different workspaces is the last thing I would
recommend to do.
Out of curious, what changes the variable that you want to
monitor? An acquisition board? A timer?
"Bruno Luong" <b.luong@fogale.fr> wrote in message <fuat72
$ll4$1@fred.mathworks.com>...
> "Rami AbouSleiman" <rdabousl@oakland.edu> wrote in message
> <fuaobd$hbu$1@fred.mathworks.com>...
> > HELP PLEASE
> > Is it possible to have a function that reads specific
values
> > from the workspace, even though these values are always
> > changing?
> > And when these values change the function updates its
values
> > also
>
> You could declare the variable as "global".
>
> Anyway, global variable and accessing/sharing variables
> between different workspaces is the last thing I would
> recommend to do.
>
> Out of curious, what changes the variable that you want to
> monitor? An acquisition board? A timer?
>
> Bruno
Thanks Bruno but i declared already as global thats why the
workspcae is changing but not the function.
Its the mouse movement on a figure (variables changing)
"Rami AbouSleiman" <rdabousl@oakland.edu> wrote in message
<fub08i$nek$1@fred.mathworks.com>...
> Thanks Bruno but i declared already as global thats why the
> workspcae is changing but not the function.
I'm not sure I understand:
when a variable is declared as global, it stores in a space
that is common for all workspaces (WS).
Each function has they own WS. In order to access to this
variable, the variable should be declared as global in the
function, otherwise the homonym variable (same name) is
created in a local workspace.
You could also use "evalin" and "assignin" for manipulation
variables at different WS.
For mouse position, check out also this:
get(0, 'PointerLocation')
> Is it possible to have a function that reads specific values
> from the workspace, even though these values are always
> changing?
> And when these values change the function updates its values
> also
You can use 'evalin' for reading from and 'assignin' for writing to
the base workspace. For example,
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.