Using TinyMAT library in c++

Hello everyone.
I am programming in c++ and I am using the TinyMAT library to export what I have written in c++ to matlab.
I need to write a .mat file with a structure in it.
For example, I have:

TinyMATWriterFile* mat=TinyMATWriter_open('data_set.mat') % I open a new .mat file
if (mat){
TinyMATWriter_startStruct(mat,"EEG") % I oper a new structure in .mat file

...
write the contents of struct
...


TinyMATWriter_endStruct(mat)
TinyMATWriter_close(mat)

}

In this way I cannot fill the structure but only the file.
Would someone who has used this library in c++ be able to tell me how to do it, please?
https://github.com/jkriege2/TinyMAT -> Does the example shown on their main github page help you?

I don't have experience with TinyMAT, but it looks like the "mat structs" are accessible through a std::map that you fill in yourself. std::map -> http://www.cplusplus.com/reference/map/map/

There is a folder in their github called examples, compile these example codes, run and compare the output.

There are many different ways to use std containers to write portions of a mat file: the full list of write-functions can be found in their API description: -> http://jkriege2.github.io/TinyMAT/group__tinymatwriter.html

Try looking at some existing mat files and figure out which write functions might be used to create the structures in those files. Check out some hello world mat files. Write some pseudo-code and then implement it. I suggest creating pseudo-code for the expected output mat file as well, just to help figure out things if they don't match your expected results.
Last edited on
Topic archived. No new replies allowed.