Variable types in coder generated C - use in existing C codes
Afficher commentaires plus anciens
Hi,
I want to use Coder to translate some functions into C, then I want to use the generated code in other native C programs. I have some questions regarding variable types (particularly cell arrays)
Suppose I have the following 'do nothing' code...
clear
names = {'contrast1','contrast2','contrast3'};
data = {[1 2 3],[4 5 6],[7 8 9]};
saveStruct(names,data);
where the function 'saveStruct' is just... (i.e. does nothing - I just want to see the codes..)
function saveStruct(names,data)
a = 1;
end
Now, if I run saveStruct through coder with dynamic array sizing, I get.....
#include "rt_nonfinite.h"
#include "saveStruct.h"
/* Function Definitions */
void saveStruct(const emxArray_cell_wrap_0 *names, const emxArray_cell_wrap_1
*data)
{
(void)names;
(void)data;
}
It looks like the emxArray_cell_wrap is some sort of wrapper that TMW has developed to handle dynamic sized cell arrays. I have three main questions here...
1. Suppose I wanted to call this function from native C. What would the incoming variable types be? Would I need to import this wrapper into the calling code and create these 'cell arrays' manually? If so, what would the 'main' funtion look like in this case? (is there Doc??)
2. Ditto, suppose I want to call another function from here. How would that look 'downstream'?
3. If I wanted to save/load names and data to/from a file from within saveStruct? How would that be done?
Finally, does anyone know of any blogs/examples etc that show an example of the use of Coder generated code in an Eclipse-CDT project?
Many Thanks,
Arwel
Réponse acceptée
Plus de réponses (1)
Sri Murali
le 14 Fév 2023
0 votes

how to solve this equation in MATLAB
Catégories
En savoir plus sur Function Definition dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!