multi-level C structure interface from matlab to C dll

Status
Not open for further replies.

rmreddy

Member level 3
Joined
Feb 20, 2007
Messages
65
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
1,718
Hi,
I am trying to link a C dll and run from matlab environment.
THe C code has data structure which is of multi-level hierarchy.

The c structure looks like this:

typedef struct structureB
{
unsigned short int g;
unsigned short int h;
float ii;
}strucB;

typedef struct structureA
{
unsigned int e;
unsigned int f;

strucB b1;
}structA;

typedef struct ab
{
unsigned short int a;
unsigned short int b;
unsigned int c;
unsigned int d;

strucA a1[2];
}simConfig;

As you could see, 'structA' has multiple instances in 'strcut ab'. Unfortunately, i am not able to fill the data fields in matlab for 'struct a1', matlab is seeing this member as an 'array' of size two rather than a structure..????

earliest help is much appreciated...
 

Hi;
strucA a1[2];
Is this kind of struct definition available in C?? What is the meaning of it?
Do you want to define 2 strucA variable in struct simConfig?
 

Yes, i want to create an array of structure of type 'strucA'.
something like this:
simConfig->a1[0].e
simConfig->a1[0].f
simConfig->a1[0].b1.g
simConfig->a1[0].b1.h
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…