getFitParamsStructArrayFromTable.m 497 B

12345678910111213
  1. function [fitParams, gof] = getFitParamsStructArrayFromTable(StimTable)
  2. nChannels = size(StimTable.responseIndex{1}, 1); % (Dirty?) wa to get nChannels.
  3. fitCellArray = StimTable.paramTuning;
  4. fitStructArray = [fitCellArray{:}];
  5. fieldNames = fieldnames(fitStructArray(1).fit);
  6. gof = FlattenStruct(reshape([fitStructArray.gof], nChannels, []));
  7. for iField = 1: numel(fieldNames)
  8. fitParams.(fieldNames{iField}) = arrayfun(@(x) x.fit.(fieldNames{iField}), fitStructArray);
  9. end
  10. end