Error using the same inp file

Hi! My code gives me the following errors when I try to compute the simulations in a for loop:

Warning: Error 304: cannot open binary output file
In epanet.apiENgeterror (line 1055)
In epanet/getComputedTimeSeries_ENepanet (line 9135)
In my_code (line 101)
Dot indexing is not supported for variables of this type.

Error in epanet>readEpanetBin (line 22340)
v.Time = (0:value.BinReportingTimeStepSec:value.BinSimulationDurationSec)’;

Error in epanet/getComputedTimeSeries_ENepanet (line 9137)
value = readEpanetBin(fid, binfile, 0);

Error in my_code (line 101)
sol = inp.getComputedTimeSeries_ENepanet;

At the beginning of my code, I import the .inp file:

inp = epanet([filename '.inp']);

Afterward I have the for loop with:

for g = 1:Ng
         Node_k = [...] ;
         inp.setNodeEmitterCoeff(Node_index, Node_k)
         sol = inp.getComputedTimeSeries_ENepanet;

The code always stops at count = 506 with the errors shown above.
It doesn’t stop if I import the .inp file again and again in each iteration of the for loop.
I also tried to save the inp variable in a .mat file and load it after clearing the variable in each iteration but the same errors are given.

I have a very large number of iteration and I cannot afford to import the .inp file so many times because it is very time expensive.
How could it be avoided? Why those errors?

I suggest to use “.getComputedTimeSeries”.
Maybe the problem is related to the binary file.

I thank you, this solved the problem!