Dimension of fields in mwArray structs?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I have a quesiton about the dimensions of the structs created by mwArray when the structs have fields.
For example,
const char *fields[] = {"field1", "field2"};
mwSize dims[2] = {2, 2};
mwArray m(2,dims, 2, fileds);
In this case, is field1 and field2 a 2x2 matrix?
What can I do if I want to have a mxn matrix in field1 and a jxk matrix in field2?
Thank you.
0 Kommentare
Antworten (1)
Kaustubha Govind
am 10 Feb. 2011
I think what you're declaring is really a 2x2 matrix of structures with two fields: field1 and field2.
You could try the alternative syntax for mwArray:
const char *fields[] = {"field1", "field2"};
mwSize dims[2] = {1, 1};
mwArray m(2,dims, 2, fields);
mwArray field1(m, n, mxDOUBLE_CLASS);
mwArray field2(j, k, mxDOUBLE_CLASS);
m.Get(fields[0],1,1).Set(field1);
m.Get(fields[1],1,1).Set(field2);
2 Kommentare
Kaustubha Govind
am 16 Feb. 2011
I think you do need to assign the values explicitly - I am not aware of a way to do this directly.
Siehe auch
Kategorien
Mehr zu Deploy to C++ Applications Using mwArray API (C++03) finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!