How to write structs within structs in mex functions?

Hello,
I am currently writing a standalone C code actually to write a .mat file with the MAT-File API which uses mex functions. I have the following structure:
struct position
{
float x, y, z;
};
struct orientation
{
float x, y, z;
};
struct robot
{
string name;
position pose;
orientation or;
};
Then in the main I just use struct robot data to populate my data. How do I do this so as to have several 1x1 struct in matlab environment?
Thanks.

댓글 수: 1

Are you simply asking how to convert a "robot" struct into an mxArray? E.g., for writing to a mat file and using in MATLAB? Do you want the x, y, z fieldnames carried along or would you rather have them combined into a single vector?

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

태그

질문:

2016년 4월 27일

댓글:

2016년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by