Buses as inputs/outputs in C MEX S-Functions and vectors as structure members
Mostra commenti meno recenti
Hi everybody,
I need help, I've already learned how to define buses as outputs/inputs of a c-mex functions with the legacy code tool but what I need now is that my structures which are actually the buses have vectors as members. Something like :
typedef struct sTestData {
std::vector<Type_A> member1;
std::vector<Type_B> member2;
} TestData_t;
when I try to generate the code for the c-mex function and compile it I receive several errors :
error C2039: '..': is not a member of 'std::vector<_Ty>' with [ _Ty=Type_A ]
I hope someone can help me.
Risposte (1)
Kaustubha Govind
il 24 Ago 2012
1 voto
First, std::vector is a C++ data structure, so you can't use them inside C S-functions, you'll need to use C++ S-functions. Second, Simulink does not support dynamic allocation, so data structures like std::vectors are not allowed. You might need to convert your std::vectors to built-in arrays (which is fairly easy using an intermediate type and extracting the built-in array under the std::vector using &member1[0]) of fixed-size (or of a fixed maximum size at any rate if you plan to create a bus containing variable-size signals).
2 Commenti
N P
il 24 Ago 2012
Kaustubha Govind
il 27 Ago 2012
What are Type_A and Type_B typedef'd to? Is the type declaration in the same header?
Categorie
Scopri di più su Block and Blockset Authoring in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!