-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create a 1xN structure? #6
Comments
You could use TinyMATWriter_writeMatrix2D_colmajor() ... see http://jkriege2.github.io/TinyMAT/group__tinymatwriter.html#ga710d61be33f483e62fe187c06bad5e38 |
Did it work for you? Can I close this issue? |
Thanks you for support but it is not what I was looking for. This function
doesn’t create a structure 1xN but a matrix. I need to create a multiple
fields structure and each field should contains different type of data
(string, double,int). Have you got anything alse to suggest me, please?
Il giorno sab 28 mag 2022 alle 21:33 Jan W. Krieger <
***@***.***> ha scritto:
… Did it work for you? Can I close this issue?
—
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZKAW7T2OHAGORMVNVZK7ODVMJYHZANCNFSM5W2AQHQA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hmmm ... let's see ... I think there are two options for that ... if I understand correctly:
std::map<std::string, double> mp1;
mp1["x"]=100;
mp1["y"]=200;
mp1["z"]=300;
mp1["longname"]=10000*M_PI; TinyMATWriter_writeStruct(mat, "struct1", mp1); This creates a struct with fields that contain one double each ... so this is very limited. TinyMATWriter_startStruct(mat, "struct1");
// ... use all other instructions here ... variables will be put as fields into the struct
//... you can also use another start/endStruct pair to nest structs
TinyMATWriter_endStruct(mat); There is also a similar interface for cell arrays ... Does this help? If so, I can look for a better example and update the documentation within the next 1-2 weeks |
Thanks but with the first option I don't resolve my problem.
Instead, the second option is most efficiently but it don't resolve totally
my problem.
I would create a structure like this:
[image: Schermata 2022-05-30 alle 09.05.34.png]
Can you suggest anything else, please?
Il giorno dom 29 mag 2022 alle ore 11:27 Jan W. Krieger <
***@***.***> ha scritto:
… Hmmm ... let's see ... I think there are two options for that ... if I
understand correctly:
1. There is a simple interface to write structs:
std::map<std::string, double> mp1;
mp1["x"]=100;
mp1["y"]=200;
mp1["z"]=300;
mp1["longname"]=10000*M_PI; TinyMATWriter_writeStruct(mat, "struct1", mp1);
This creates a struct with fields that contain one double each ... so this
is very limited.
3. There is a low-level interface for structs that is very flexible:
TinyMATWriter_startStruct(mat, "struct1");// ... use all other instructions here ... variables will be put as fields into the struct //... you can also use another start/endStruct pair to nest structsTinyMATWriter_endStruct(mat);
There is also a similar interface for cell arrays ...
Does this help? If so, I can look for a better example and update the
documentation within the next 1-2 weeks
—
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZKAW7VZJ6WK7QSOH6JTGJ3VMMZ7FANCNFSM5W2AQHQA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
hello , Do you have solved this problem. if you always solve it. Can you tell me how you to do? Thanks @maryambrosino |
Hello everyone.
I would like to create a struct with size 1xN.
For example:
field1 field2
A 1
B 2
C 3
D 4
... ....
Which TinyMAt functions (or combination of them) can I use ?
The text was updated successfully, but these errors were encountered: