Support for returning structs from C-Function Call block

Post Reply
bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

Support for returning structs from C-Function Call block

Post by bmairs » Sat Aug 28, 2010 5:59 pm

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.

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

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

Post by LubinKerhuel » Fri Sep 03, 2010 6:57 pm

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

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

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

Post by bmairs » Mon Sep 13, 2010 11:58 pm

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.

bmairs
Posts: 69
Joined: Mon Jul 27, 2009 7:51 pm

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

Post by bmairs » Thu Jan 19, 2012 6:10 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests