function [] = appendNewDay(searchname,dateObj,dateFormat,minTset,PelecTOTAL,PdiscTOTAL,minCost,WattTOTAL,DOY)
    fid = fopen(searchname,'a');                 
    dateStr = [datestr(dateObj,dateFormat),','];
    TsetStr = sprintf('%.3f,',minTset(1:14));
    emptyStr = [num2str(PelecTOTAL),',',num2str(PdiscTOTAL),',',num2str(minCost),',', ...
                num2str(WattTOTAL),',',num2str(DOY),',',datestr(datetime('now'),'HH'),',',datestr(datetime('now'),'MM'),','];
    writeStr = [dateStr,TsetStr,emptyStr];
    fprintf(fid,'%s\n',writeStr(1:end-1));
    fclose(fid);         
end 