function ICtoFile(SimulDuring, X0, P, jP, filename)

fid = fopen(filename,'wb');

if (fid ~= -1)
    
    fwrite(fid , SimulDuring(1), 'double');
    fwrite(fid , X0(1:12), 'double');
    fwrite(fid , P.reltol(1), 'double');
    fwrite(fid , P.abstol(1:12), 'double');
    fwrite(fid , P.param(1:10), 'double');
    dirDo = [jP.dirX(1) jP.dirY(1) jP.dirZ(1) jP.dirR(1) jP.doX(1) jP.doY(1) jP.doZ(1) jP.doR(1)];
    fwrite(fid , dirDo, 'int');

    fclose(fid);

else
    error(['Coud not open file ''' filename '''!']);
end