Closed dimitri-yatsenko closed 11 years ago
mym handles logical arrays in blobs just fine. I don't know why we perform the uint8 conversion in dj.BaseRelvar.insert().
i cannot recall now why I added the special logic to handle boolean arrays. I think it was in response to something Mani did. I will take it out and test it.
The change happened in March 2011 but there is no commit comment in the SVN repo to explain it.
Just tested it. When I try to insert a boolean array, I get the following error:
Error using mym
Matlab placeholder only support array, structure, or cell
Here is the code in mym.cpp
that appears to exclude logical arrays
if (*pt==PH_MATLAB) {
// this placeholder results in a serialized version of array, cell or structure
rpec = true;
if (mxIsNumeric(rparg)||mxIsChar(rparg))
rpf = &serializeArray;
else if (mxIsCell(rparg))
rpf = &serializeCell;
else if (mxIsStruct(rparg))
rpf = &serializeStruct;
else
mexErrMsgTxt("Matlab placeholder only support array, structure, or cell");
}
Ah yes, you are right. I was running a different branch. Logical arrays are correctly treated in mym at n-1 out of n locations, e.g. you can have them in your structs or cell arrays and everything works fine. It is only if they are the top-level object being serialized that you get this error, as shown in the code fragment above. It's a one-line fix; I'll push it later.
Currently, mym does not accept logical arrays in blobs. DataJoint works around this issue by converting logical arrays into uint8, but it does not know to convert them back into logical when fetching.