@@ -1467,8 +1467,35 @@ function setFitResidual(fitObj,M)
14671467 ensHistObject{i } = History .fromStructure(structure.ensHistObjects{i });
14681468 end
14691469 configColl = ConfigColl .fromStructure(structure .configs );
1470- % fitObj=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObj,lambda,b, dev, stats,AIC,BIC,logLL, configColl,XvalData,XvalTime,distribution)
1471- fitObj= FitResult(spikeObj ,structure .covLabels ,structure .numHist ,histObjects ,ensHistObject ,lambda ,structure .b , structure .dev , structure .stats ,structure .AIC ,structure .BIC ,structure .logLL ,configColl ,structure .XvalData ,structure .XvalTime ,structure .fitType );
1470+
1471+ % Support legacy saved structures that predate select fields.
1472+ logLL = NaN(1 ,max(1 ,structure .numResults ));
1473+ if isfield(structure ,' logLL' )
1474+ logLL = structure .logLL ;
1475+ if isscalar(logLL ) && structure .numResults > 1
1476+ logLL = repmat(logLL ,1 ,structure .numResults );
1477+ end
1478+ end
1479+
1480+ XvalData = [];
1481+ if isfield(structure ,' XvalData' )
1482+ XvalData = structure .XvalData ;
1483+ end
1484+
1485+ XvalTime = [];
1486+ if isfield(structure ,' XvalTime' )
1487+ XvalTime = structure .XvalTime ;
1488+ end
1489+
1490+ fitType = ' ' ;
1491+ if isfield(structure ,' fitType' )
1492+ fitType = structure .fitType ;
1493+ elseif isfield(structure ,' distribution' )
1494+ fitType = structure .distribution ;
1495+ end
1496+
1497+ % fitObj=FitResult(spikeObj,covLabels,numHist,histObjects,ensHistObj,lambda,b, dev, stats,AIC,BIC,logLL, configColl,XvalData,XvalTime,distribution)
1498+ fitObj= FitResult(spikeObj ,structure .covLabels ,structure .numHist ,histObjects ,ensHistObject ,lambda ,structure .b , structure .dev , structure .stats ,structure .AIC ,structure .BIC ,logLL ,configColl ,XvalData ,XvalTime ,fitType );
14721499 fitObj .setKSStats(structure .Z ,structure .U , structure .KSStats .xAxis , structure .KSStats .KSSorted , structure .KSStats .ks_stat );
14731500 fitObj .setInvGausStats(structure .X ,rhoSig ,confBoundSig );
14741501 fitObj .setFitResidual(M );
@@ -1743,4 +1770,4 @@ function setFitResidual(fitObj,M)
17431770end
17441771
17451772
1746-
1773+
0 commit comments