VH-Lab / NDI-matlab

NDI (Neuroscience Data Interface) is a cross-platform interface standard for reading neuroscience data and storing the results of analyses
Other
13 stars 9 forks source link

when creating more than one openminds document, it only creates the first one #239

Closed stevevanhooser closed 1 year ago

stevevanhooser commented 1 year ago

Eivind reports that this fails to create person2:

person1 = personWithOneAffiliation();
person2 = personWithTwoAffiliations();

personArray = [person1, person2];
s = ndi.database.fun.openMINDSobj2ndi_document(personArray);
generatedTypes = string(size(s));
for i = 1:numel(s)
    generatedTypes(i) = s{i}.document_properties.openminds.openminds_type;
end

generatedTypes'
stevevanhooser commented 1 year ago

OK, the problem is that the function expects cell arrays rather than arrays. Presumably, in the general case openminds objects cannot be combined into an array because they are different types, although they can be here.

I made the function ndi.database.fun.openMINDSobj2ndi_document fix arrays to be cell arrays.

It seems to work now.

stevevanhooser commented 1 year ago

This code should now work, but a session_id needs to be passed to openMINDSobj2ndi_document:

person1 = personWithOneAffiliation();
person2 = personWithTwoAffiliations();

session_id = S.id(); % get the session id from the ndi.session objects

personArray = [person1, person2];
s = ndi.database.fun.openMINDSobj2ndi_document(personArray,session_id);
generatedTypes = string(size(s));
for i = 1:numel(s)
    generatedTypes(i) = s{i}.document_properties.openminds.openminds_type;
end