begT=datetime(2018,01,01);
endT=datetime(2018,02,28);

begMJD=juliandate(begT)-2400000.5;
endMJD=juliandate(endT)-2400000.5;
batStr= 'C: \n cd Program Files (x86)/Trimble/convertToRINEX/ \n ';

%1.cyklus for pro mjd v rozsahu beg MJD›endMJD
%1.1převést aktuální mjd na datetime

for mjd=begMJD:endMJD
    thisDate=datetime(mjd+2400000.5,'convertfrom','juliandate');
    thisYear=datestr(thisDate,'yyyy');
    thisMonth=datestr(thisDate,'mm');
    thisDay=datestr(thisDate, 'dd');
    %vytvoření jednoho řádku do souboru*.bat
    thisStr=sprintf( 'convertToRinex.exe T:/Studenti/Geodeti/Nosalkova/CADM/%s/T02/5423R48793%s%s%s0000D.T02 -p T:/Studenti/Geodeti/Nosalkova/novy/%s/%s/%s -v 3,04 -d -s -o "GED VUT" -ag "VUT BRNO" -mo "CADM" -mn "CADM" -an 5000119368 \r\n ', thisYear,thisYear, thisMonth,thisDay,thisYear,thisMonth,thisDay);
    batStr=[batStr thisStr];
    
end
    %zápis do souboru bat
    out=fopen('runConvertToRINEX.bat','w');
    fprintf(out, batStr);
    fclose(out);
    
