diff --git a/code/+nansen/+dataio/+session/listSessionFolders.m b/code/+nansen/+dataio/+session/listSessionFolders.m index 701a0e62..54dab0ce 100644 --- a/code/+nansen/+dataio/+session/listSessionFolders.m +++ b/code/+nansen/+dataio/+session/listSessionFolders.m @@ -21,6 +21,7 @@ allDataLocationNames = {dataLocationModel.Data.Name}; + % Get indicies for datalocation items to list session folders from if ischar(dataLocationName) && strcmp(dataLocationName, 'all') ind = 1:numel(dataLocationModel.Data); elseif ischar(dataLocationName) || iscell(dataLocationName) diff --git a/code/+nansen/+manage/detectNewSessions.m b/code/+nansen/+manage/detectNewSessions.m index a2d4e9d8..07af417a 100644 --- a/code/+nansen/+manage/detectNewSessions.m +++ b/code/+nansen/+manage/detectNewSessions.m @@ -84,6 +84,9 @@ % Todo: This should not be necessary, just make sure from the get-go % that all datalocations structs are "extended" dataLocationOriginal = metaTable.entries{1, 'DataLocation'}; + if iscell(dataLocationOriginal) + dataLocationOriginal = dataLocationOriginal{1}; + end fieldsOriginal = fieldnames(dataLocationOriginal); dataLocationNew = sessionArray(1).DataLocation; fieldNamesNew = fieldnames(dataLocationNew); diff --git a/code/+nansen/+metadata/+type/Session.m b/code/+nansen/+metadata/+type/Session.m index 660cc22e..f69a7ebc 100644 --- a/code/+nansen/+metadata/+type/Session.m +++ b/code/+nansen/+metadata/+type/Session.m @@ -117,7 +117,7 @@ function constructFromDataLocationStruct(obj, dataLocationStruct) %constructFromDataLocationStruct Construct object(s) % Todo: Support vector of objects. - % Todo: Should I accept old and new dataLocation structure? + % Todo: Should I accept old and new dataLocation structure? NO obj.DataLocation = dataLocationStruct; obj.autoAssignPropertiesOnConstruction() @@ -339,8 +339,8 @@ function fixDataLocations(obj) rootPaths = {dataLocation.RootPath.Value}; for k = 1:numel(rootPaths) - tf = contains( obj(j).DataLocation.(name), rootPaths{k} ); - if ~isempty(tf) + isMatched = contains( obj(j).DataLocation.(name), rootPaths{k} ); + if isMatched root = rootPaths{k}; rootIdx = k; break