This is the code I was given, however it takes too long to run. How would I make this faster by removing the nested for loop?
for iGroup = 1:length(groupIndices)
curGroupIndex = groupIndices(iGroup);
curChanIndices = chanIndices{iGroup};
curChanNames = chanNames{iGroup};
groupPropStruct = propsToStruct(propNames{curGroupIndex},propValues{curGroupIndex},REPLACE_STR,PREPEND_STR,ALWAYS_PREPEND);
groupStruct = struct('name',groupNames(iGroup),'props',groupPropStruct);
for iChan = 1:length(curChanIndices)
curChanIndex = curChanIndices(iChan);
chanPropStruct = propsToStruct(propNames{curChanIndex},propValues{curChanIndex},REPLACE_STR,PREPEND_STR,ALWAYS_PREPEND);
chanStruct = struct('name',curChanNames{iChan},'props',chanPropStruct,...
'data',[]);
chanStruct.data = data{curChanIndex};
groupStruct.(TDMS_genvarname2(chanStruct.name,...
REPLACE_STR,PREPEND_STR,ALWAYS_PREPEND)) = chanStruct;
end
output.(TDMS_genvarname2(groupStruct.name,...
REPLACE_STR,PREPEND_STR,ALWAYS_PREPEND)) = groupStruct;
end