Closed Foucl closed 7 years ago
Thank you for finding another bug in Transplant!
Would this be worthy of a pull request?
Absolutely! Although I would prefer
if isstruct(data)
if ~isempty(fieldnames(data))
data = containers.Map(fieldnames(data), struct2cell(data));
else
data = containers.Map();
end
end
Personally, I'd prefer it if you did a pull request instead of me doing it, just to document your contribution in the commit history. If that's too much work, I can do the commit as well.
While trying to work with Labstreaming Layer's xdf-files and the way they are read into matlab by their importer, I ran into an issue in
dumpmsgpack.m
. LSL's reader function generates deeply nested structs that sometimes have empty 'substructs'.Example: In Matlab:
Trying to execute this from a transplant.Matlab() instance (
s = matlab.gen_struct_empty_fields()
) throws the following traceback:For me, simply doing this
in dumpmsgpack.m L45 solves the issue (at least for my use case). Would this be worthy of a pull request?