How to write structs within structs in mex functions?
Show older comments
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 Comment
James Tursa
on 4 May 2016
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?
Answers (0)
Categories
Find more on Workspace Variables and MAT Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!