Is there a way to send a list of variables from a function (global) to a workspace (local). I need to save them as numeric data type double, and not string, but I can convert if I can get them into a string

3 views (last 30 days)
kbl
  2 Comments
KSSV
KSSV on 17 Nov 2017
If a variable is global, it is already in workspace......for the other part..it is not clear...show us your code.
Stephen23
Stephen23 on 17 Nov 2017
"Is there a way to send a list of variables from a function (global) to a workspace (local)."
Sounds strange. Why not just pass the values using more standard, reliable, and efficient paradigms, e.g. passing arguments or nested functions?
You might like to read this:

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 17 Nov 2017
  • There are methods to send a value into an already-executing function if you are using the Parallel Processing Toolbox
  • You could use one of the File Exchange contributions to serialize the variables into text, and use the Instrument Control Toolbox to send them into the already-executing function using tcp or udp, which would then deserialize them. The already-executing function would need to actively check for the packets. However, in order to escape from execution of the already-executing function in order to do the sending, you would need to have arranged that a callback be executed, such as a timer.
  • You could attach the variables to UserData or application data to a graphics object that the already-executing function knew to check. The already-executing function would need to actively check for the updates. However, in order to escape from execution of the already-executing function in order to do the sending, you would need to have arranged that a callback be executed, such as a timer.
But probably you need something different than these.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!