Convert C struct to matlab struct

조회 수: 4 (최근 30일)
zohar
zohar 2011년 8월 23일
Hi all
I have two applications the first is written in c language and the other in matlab language, they are both communicateby using tcp.
Application 1(c language) send struct data to application 2(matlab language).
How can i make matlab recognize the received data as a struct data?
For example :
myfile.h
struct My_struct1
{
int x;
int y[10];
};
struct My_struct2
{
char x1;
char y1[10];
float x2;
float y2[10];
double x3;
double y3[10];
My_struct1 z;
};
I want to send My_struct2 from c to matlab.
Thx

채택된 답변

Chirag Gupta
Chirag Gupta 2011년 8월 23일
Depends on the medium? How are you communicating with C in MATLAB? a) Are you using MEX files?
In that case you could create a mxStruct of the same type and fill it up with data and send it to MATLAB,
b) Are you using Generic C dlls, (loadlibrary) command in MATLAB that loads a C dll. If thats the case, you can use libstruct to get the data in MATLAB.
  댓글 수: 1
zohar
zohar 2011년 8월 24일
Hi Chirag
I am not using any MEX files or any C dll.
The both applications are independent and located at different computers.
Sorry but I accepted the answer by mistake (I posted another one more specified).
Any help ?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by