Well, I can see this question rather old, but still I would be very interested in a answer as well.
Especially if this answer qould solve the problem of returning multiple return values from a single function.
Currently I am looking into a solution, that somewhat interacts similar to a mexFunction.
e.g. [int y1, int y2] = fun(int u1, int u2)
I stumbled upon an example that mentioned following struture:
Declared in mex.h (line 141+ in R2014b)
void mexFunction (
int nlhs, /* number of expected outputs */
mxArray *plhs[], /* array of pointers to output arguments */
int nrhs, /* number of inputs */
mxArray *prhs[], /* array of pointers to input arguments */
);
If this could be implemented with the support of the legacy_code tool, it would be fantastic, but I fear I mistunderstood something. The problem should be 'mxArray' since it isn't a supported Datatype as far as I can see.
Still, I would be happy if someone had a solution that would help me to receive multiple values from one called function / method by a wrapper function utilized with the legacy_code tool.
With best regards,
Christian
"Laura" wrote in message <hovvr0$m1t$1...@fred.mathworks.com>...structure are updated. When I use this function within a c library, the calling program then grabs the updated values to finish whatever processing is required.
Hello,
I have a fairly complex c function that I need to call in simulink using the legacy code tool. Specifically, this function returns multiple outputs by expedient of passing in a structure variable by reference. Within the function, the values in this
because the function must not change the value of of input arguments, and that is what I end up doing. Nor can I modify my function to return a reference to the output structure, since the same rules state I can't have a function return a pointer.Now, I'd like to be able to call this function from a simulink model. However, according to the documentation at "http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/sfg/bq4g1es-1.html#bq4g1es-6" on how to do so, I cannot actually do this
the legacy code tool with pointers to structures as inputs to a function?Now, I don't see anything that indicates I can't simply return the output structure directly, but I can't seem to find any directions on how this is actually done. Can someone point me to an example? For that matter, are there any examples of using
Does anybody get a solution here?Thanks,
Laura
Well, I can see this question rather old, but still I would be very interested in a answer as well.
Especially if this answer qould solve the problem of returning multiple return values from a single function.
Currently I am looking into a solution, that somewhat interacts similar to a mexFunction.
e.g. [int y1, int y2] = fun(int u1, int u2)
I stumbled upon an example that mentioned following struture:
Declared in mex.h (line 141+ in R2014b)
void mexFunction (
int nlhs, /* number of expected outputs */
mxArray *plhs[], /* array of pointers to output arguments */
int nrhs, /* number of inputs */
mxArray *prhs[], /* array of pointers to input arguments */
);
If this could be implemented with the support of the legacy_code tool, it would be fantastic, but I fear I mistunderstood something. The problem should be 'mxArray' since it isn't a supported Datatype as far as I can see.
Still, I would be happy if someone had a solution that would help me to receive multiple values from one called function / method by a wrapper function utilized with the legacy_code tool.
With best regards,
Christian
"Laura" wrote in message <hovvr0$m1t$1...@fred.mathworks.com>...structure are updated. When I use this function within a c library, the calling program then grabs the updated values to finish whatever processing is required.
Hello,
I have a fairly complex c function that I need to call in simulink using the legacy code tool. Specifically, this function returns multiple outputs by expedient of passing in a structure variable by reference. Within the function, the values in this
because the function must not change the value of of input arguments, and that is what I end up doing. Nor can I modify my function to return a reference to the output structure, since the same rules state I can't have a function return a pointer.Now, I'd like to be able to call this function from a simulink model. However, according to the documentation at "http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/sfg/bq4g1es-1.html#bq4g1es-6" on how to do so, I cannot actually do this
the legacy code tool with pointers to structures as inputs to a function?Now, I don't see anything that indicates I can't simply return the output structure directly, but I can't seem to find any directions on how this is actually done. Can someone point me to an example? For that matter, are there any examples of using
Does anybody got a solution for this?Thanks,
Laura
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (2 / 14) |
Uptime: | 51:33:26 |
Calls: | 6,690 |
Calls today: | 8 |
Files: | 12,225 |
Messages: | 5,344,715 |
Posted today: | 1 |