Page 1 of 1

Support for returning structs from C-Function Call block

Posted: Sat Aug 28, 2010 5:59 pm
by bmairs
I'm not certain if this is possible, but it would be awesome if you could specify a struct that the c-function call block was returning and then the block would output the data on a bus with the appropriately named signals. Right now it's inconvenient and computationally wasteful to pack a struct into a vector of uints for the c-function call block and to then unpack it in Matlab.

Re: Support for returning structs from C-Function Call block

Posted: Fri Sep 03, 2010 6:57 pm
by LubinKerhuel
This would be for returning values ? (block output)

It may be Ok for the block to parse the C file and to extract some informations, but what to do with ?

Perhaps, it may be possible to declare a structure. The C function output would be a pointer to this sctucture and the block could pase the file and use the structure elements name to provide as many output as the element numbers ?
however, as the block output will be scalars, simulink would expect their value and not a pointer toward theses elements.

It may thus be necessary to build a converter... that would not be efficient I guess.

If you have any suggestions...
Lubin

Re: Support for returning structs from C-Function Call block

Posted: Mon Sep 13, 2010 11:58 pm
by bmairs
What I mean is for the C-function blocks to be able to work natively with Simulink Bus objects. This means that they could take them as input or output. I would imagine this could be done because of the support Busses have over various blocks, but I don't know how this all works.

I just know I spend a lot of time packing/unpacking data into uint8 vectors so I can go between C code and Simulink code. That's a lot of additionalcode and computation.

Re: Support for returning structs from C-Function Call block

Posted: Thu Jan 19, 2012 6:10 pm
by bmairs
Is there any possibility for this support to be added? I use busses extensively in my Simulink code and being able to pass them unmodified into the C-function call block would drastically simplify my models.