Traverse cell array of structures of ... in mex
古いコメントを表示
Does anyone have a nice .mex example where we pass in a cell array of struct, and interrogate fields in each structure?
This mex newby is baffled as to why mxIsStruct returns false when the following is passed a cell array of struct:
void blah(mxArray* X)
mxArray* pm;
mwIndex i;
i = 1;
pm = mxGetCell(X,i);
if (~mxIsStruct(pm)) {
mexErrMsgTxt("Not a structure");
}
1 件のコメント
Kaustubha Govind
2011 年 3 月 16 日
What do you see when you print mxGetClassName(pm)?
採用された回答
その他の回答 (3 件)
Jan
2011 年 3 月 16 日
1 投票
Kaustubha Govind
2011 年 3 月 15 日
0 投票
The example phonebook.c accepts an array of structs and returns a cell array - this should serve as a good starting point.
James Tursa
2011 年 3 月 16 日
C is 0-based indexing. You have this in your code:
i = 1;
Are you sure you have two elements in X? Or did you mean:
i = 0;
カテゴリ
ヘルプ センター および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!