Compiler: Load shared data

2 views (last 30 days)
Tobias
Tobias on 5 Nov 2012
Hey,
here is what I want to do: I want to load some data into memory which is shared among Matlab functions in a shared library. I don't need that data in my C++ application. One way would be to use a global variable in all these Matlab functions and call a function to initialize it before calling those functions. Is there a more elegant way to do this?

Answers (1)

Image Analyst
Image Analyst on 5 Nov 2012
They can all read in the same mat file. Do each of these functions want to change the variables and have the updated variables available in the other functions? Then see the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
  1 Comment
Tobias
Tobias on 5 Nov 2012
Edited: Tobias on 5 Nov 2012
Thanks for you answer. No, these functions only need to read the data. If I use a handle to pass around my data, will Matlab just return a reference to the C++ program? More specifically, here is my plan:
C++ program gets Matlab reference r after calling readData()
C++ program calls Matlab function with r as input parameter

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!