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 Kommentar

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?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Gefragt:

am 27 Apr. 2016

Kommentiert:

am 4 Mai 2016

Community Treasure Hunt

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

Start Hunting!

Translated by