diff --git a/topas/MatRad_TopasConfig.m b/topas/MatRad_TopasConfig.m index a643b8aa4..02d37175e 100644 --- a/topas/MatRad_TopasConfig.m +++ b/topas/MatRad_TopasConfig.m @@ -399,6 +399,10 @@ function writeStfFields(obj,ct,stf,baseData,w) historyCount(beamIx) = uint32(obj.fracHistories * nBeamParticlesTotal(beamIx) / obj.numOfRuns); + if historyCount < cutNumOfBixel || cutNumOfBixel == 0 + obj.matRad_cfg.dispError('Insufficient number of histories!') + end + while sum([dataTOPAS.current]) ~= historyCount(beamIx) % Randomly pick an index with the weigth given by the current idx = 1:length(dataTOPAS);