Thread Subject: Sending data from C code to MATLAB GUI

Subject: Sending data from C code to MATLAB GUI

From: Erik

Date: 14 May, 2008 00:35:02

Message: 1 of 1

Hello all,

I am currently working on a project that uses the MCR
(Matlab Compiler Runtime) library to create a standalone
executable for my application. Currently, I have quite a bit
of C code and I am trying to send some of the data to a
MATLAB GUI that I made in GUIDE. With the MCR, I compiled
the .m produced by the GUI into a .h file that is callable
from my C code. The issue is, only the first function of the
MATLAB GUI is showing up in my .h file (I have tried using
the %#function pragma, but to no avail). This means that I
need to access every other function in my GUI file directly
from the first function. Now in the comments produced by
MATLAB, it states

% GUI_M9('CALLBACK',hObject,eventData,handles,...)
calls the local
% function named CALLBACK in GUI_M9.M with the given
input arguments.

In the .h file produced by MATLAB, there are two functions
that have been produced (GUI file name has been prefixed
with mlx and, mlf respectively)

extern LIB_libmatrix_C_API
bool MW_CALL_CONV mlxGUI_m9(int nlhs, mxArray *plhs[],
                            int nrhs, mxArray *prhs[]);

extern LIB_libmatrix_C_API bool MW_CALL_CONV mlfGUI_m9(int
nargout
                                                       ,
mxArray** varargout
                                                       ,
mxArray* varargin);

Using the second of the two, I can write the following in
the .c driver file,

mlfGUI_m9(0,NULL,mxCreateString("updatePlot"));

This appears to call the updatePlot function that I have
appended onto my GUI source file, but it complains because I
am calling handles.plotArea in the function and it does not
know what 'handles' is.

To me, it sounds like I am missing some sort of graphics
library, but I am not really sure at this point. The main
thing is, I need help with passing data, in general from C
to the MATLAB workspace, not just to the windows command
line (like it has been doing with basic disp commands from
MATLAB).

Thanks for your time.

Erik

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com