ita_kundt_protocol.m 19.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
function varargout = ita_kundt_protocol(varargin)
%ITA_KUNDT_PROTOCOL - calculates loudness level of a signal according to DIN

% <ITA-Toolbox>
% This file is part of the application Kundt for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>


% TODO:
% - path2TeX in ita_preferences`?
% - auswhle wo pdf gespeichert wird?
% - zwei variablen 'humidity' und 'luftfeuchtigkeit', eine lschen
% - einheitliche dateinstruktur, mit raw daten, temperatur, anuahl der mics, mic positionen, ...
% - ita header anders, nur ita logi in toolbox, text mit tex
% - option fuer keine smooth => text in protokoll anpassen
% - 


% normal call, no input => call gui
protocolHeaderPNG = 'KopfzeileGKB.png';
if isempty(varargin)
    protocolLanguage = questdlg('Please choose a protocol language:', ...
        'Language selection', ...
        'German','English','German');
    
    if isempty(protocolLanguage)
        return
    end
    
    linFreq = false;
    
    % raw dateien auswhlen
    [files pathName del] = uigetfile('*_raw.ita', 'MultiSelect','on');
    cd(pathName)
    pause(0.1)
    if isequal(files,0)
        return
    end
    
    
    % try to guess probe name
    try
        tmp = cell2mat(files.');
        i= 0;
        while (isequal(repmat(tmp(1,1:i+1),size(tmp,1)-1,1), tmp(2:end,1:i+1)) )
            i = i+1;
        end
        
        if i<3
            nameDerProbe = 'Probe A';
        else
            nameDerProbe = strrep (tmp(1,1:i), '_' , ' ');
        end
    catch
        nameDerProbe = 'Probe A';
    end
    %%

% enter your MIKTEX path here |  |  |  |  |  |
%                            \ /\ /\ /\ /\ /\ /
%                             .  .  .  .  .  .
% texpath = '"C:\Program Files\MiKTeX 2.8\miktex\bin\pdf.latex.exe"';
% texpath = '"D:\Program Files\MiKTeX 2.9\miktex\bin\pdflatex.exe"';
%texpath = '"D:\Programme\MiKTeX 2.9\miktex\bin\pdflatex.exe"';
texpath = '"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe"';
%                             .  .  .  .  .  .
%                            / \/ \/ \/ \/ \/ \
%                             |  |  |  |  |  |
    
    
else % mgu mode
    inStruct = varargin{1};
    protocolLanguage = inStruct.protocolLanguage;
    linFreq = inStruct.linFreq;
    pathName = inStruct.pathName ;
    files    = inStruct.files;
    nameDerProbe = inStruct.nameDerProbe;
    texpath = [ '"' fullfile(inStruct.texpath, 'pdflatex.exe') '"'];
    
    
    cd(pathName)
    pause(0.1)
    if isequal(files,0)
        return
    end
    
    
    
end

%% Settings for postprocessing and plots
TimeWindow1 = [0.18 0.222];

x_lim = [80 8000];
y_lim = [0 1];



lWidthMean = 1.5;
lWidthStd = 1.1;





raw_data= ita_read(fullfile(pathName, files));




nMeasurements = numel(raw_data);

% datum der messung
if iscell(files)
    x = dir(files{1});
elseif ischar(files)
    x = dir(files);
end
datumDerMessung = datestr(x(1).datenum, 'dd.mm.yyyy');

% TODO: in GUI auswhlen
123
protocolPath = [ita_toolbox_path filesep 'applications' filesep 'Measurement' filesep 'ImpedanceTube' filesep 'Protocol' filesep];
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557

if strcmpi(protocolLanguage, 'german')
    templateFileName = [protocolPath 'KundtGermanTemplate.tex'];
elseif strcmpi(protocolLanguage, 'english')
    templateFileName = [protocolPath 'KundtEnglishTemplate.tex'];
end
if nargin == 0
    %% GUI erstellen
    
    % TODO: GUI in english!
    pList = [];
    idx = 1;
    pList{idx}.description = 'Data Select';
    pList{idx}.datatype    = 'text';
    idx = idx+1;
    
    
    pList{idx}.datatype    = 'line'; %just draw a simple line
    idx = idx +1;
    
    pList{idx}.description = 'Datum der Messung';
    pList{idx}.helptext    = '';
    pList{idx}.datatype    = 'char';
    pList{idx}.default     = datumDerMessung;
    idx = idx+1;
    
    pList{idx}.description = 'Pruefer';
    pList{idx}.helptext    = '';
    pList{idx}.datatype    = 'char';
    pList{idx}.default     = ita_preferences('AuthorStr');
    idx = idx+1;
    
    pList{idx}.description = 'Temperatur [C]';
    pList{idx}.helptext    = '';
    pList{idx}.datatype    = 'char';
    pList{idx}.default     = '19.5';
    idx = idx+1;
    
    pList{idx}.description = 'Luftfeuchtigkeit [%]';
    pList{idx}.helptext    = '';
    pList{idx}.datatype    = 'char';
    pList{idx}.default     = '61.4';
    idx = idx+1;
    
    pList{idx}.datatype    = 'line'; %just draw a simple line
    idx = idx +1;
    
    
    pList{idx}.description = 'Bezeichnung der Probe';
    pList{idx}.helptext    = '';
    pList{idx}.datatype    = 'char';
    pList{idx}.default     = nameDerProbe;
    idx = idx+1;
    
    pList{idx}.description = 'Beschreibung der Probe';
    pList{idx}.helptext    = '';
    pList{idx}.datatype    = 'textfield';
    pList{idx}.default     = 'Anthrazitfarbiger, teils geschlossen-poriger Zellschaum. Dicke ca. 52 mm Passgenaue Platzierung der Samples im Probenhalter mit dichtem Abschluss zur Wandung. Einbau der Proben ohne Abstand vor dem schallharten Rohrabschluss.';
    pList{idx}.height      = 5;
    idx = idx+1;
    
    pList{idx}.description = 'Mittelung ueber';
    pList{idx}.helptext    = '';
    pList{idx}.datatype    = 'char_popup';
    pList{idx}.list        = 'Samples|Wiederholungen';
    if strcmp(protocolLanguage, 'German')
        pList{idx}.list        = 'Samples|Wiederholungen';
    elseif strcmp(protocolLanguage, 'English')
        pList{idx}.list        = 'samples|repetitions';
    end
    pList{idx}.default     = 'Samples'; %default value, could also be empty, otherwise it has to be of the datatype specified above
    idx = idx+1;
    
    pList{idx}.datatype    = 'line'; %just draw a simple line
    idx = idx +1;
    
    pList{idx}.description = 'Bandbreite der Glaettung [Oktaven]'; %this text will be shown in the GUI
    pList{idx}.helptext    = ''; %this text should be shown when the mouse moves over the textfield for the description
    pList{idx}.datatype    = 'char_popup';
    pList{idx}.list        = '1/1|1/3|1/6|1/12|1/24';
    pList{idx}.default     = '1/12'; %default value, could also be empty, otherwise it has to be of the datatype specified above
    idx = idx+1;
    
    pList{idx}.description = 'Wiederholungen'; %this text will be shown in the GUI
    pList{idx}.helptext    = 'Bandbreite der Glaettung wird korriegiert'; %this text should be shown when the mouse moves over the textfield for the description
    pList{idx}.datatype    = 'int';
    pList{idx}.default     = '1'; %default value, could also be empty, otherwise it has to be of the datatype specified above
    idx = idx+1;
    
    pList{idx}.datatype    = 'line'; %just draw a simple line
    idx = idx +1;
    
    pList{idx}.description = 'Bild  loeschen'; %this text will be shown in the GUI
    pList{idx}.helptext    = 'Die Grafik zur Erstellung des Protokolls wird am Ende geloescht.'; %this text should be shown when the mouse moves over the textfield for the description
    pList{idx}.datatype    = 'bool'; %based on this type a different row of elements has to drawn in the GUI
    pList{idx}.default     = false; %default value, could also be empty, otherwise it has to be of the datatype specified above
    idx = idx+1;
    
    pList{idx}.description = 'TeX-Date loeschen'; %this text will be shown in the GUI
    pList{idx}.helptext    = 'Die TeX-Datei zur Erstellung des Protokolls wird am Ende geloescht.'; %this text should be shown when the mouse moves over the textfield for the description
    pList{idx}.datatype    = 'bool'; %based on this type a different row of elements has to drawn in the GUI
    pList{idx}.default     = true; %default value, could also be empty, otherwise it has to be of the datatype specified above
    idx = idx+1;
    
    
    
    pList = ita_parametric_GUI(pList,'Protokoll erstellen','wait','on','return_handles',true); % RSC - No user entry on test ita_all! If you use this function for debuging etc make a local copy!
    
    if isempty(pList)
        return
    end
    
    
    %% read data from gui
    
    datumDerMessung             = pList{1};
    nameDesPruefers             = pList{2};
    temperatur                  = pList{3};
    luftfeuchtigkeit            = pList{4};
    beschreibungDerProbe        = pList{6};
    nameDerProbe                = pList{5};
    samplesOderWiederholungen   = pList{7};
    delPictureFile              = pList{10};
    delTexFile                  = pList{11};
    smooth                      = pList{8};
    smooth_reps                 = pList{9};
    
    temp        = ita_str2num(temperatur);
humidity    =  ita_str2num(luftfeuchtigkeit)/100;
    
    
else  % mgu mode
    

    nameDesPruefers             = ita_preferences('AuthorStr');
    temperatur                  = inStruct.temperatur;
    luftfeuchtigkeit            = inStruct.luftfeuchtigkeit*100;
    beschreibungDerProbe        = inStruct.beschreibungDerProbe;
    samplesOderWiederholungen   = inStruct.sampleOderWiederholungen;
    delPictureFile              = inStruct.delPicture;
    delTexFile                  = inStruct.delTexFile;
    smooth                      = inStruct.smooth;
    smooth_reps                 = inStruct.smootheReps;
    
    
    temp     = inStruct.temperatur;
    humidity = inStruct.luftfeuchtigkeit;
end

probeFileName   = [strrep(strrep(nameDerProbe, ' ','_'), '.', ''), '_mean(' num2str(nMeasurements) ')' ];
texFileName     = [probeFileName '.tex'];
grafikName      = [probeFileName '_grafik.png'];


%% Start postprocessing

rawData_shifted = raw_data;

for iMeasurement = 1:nMeasurements
    rawData_shifted(iMeasurement) = ita_time_shift(raw_data(iMeasurement));
end



rawData_win= ita_time_window(rawData_shifted,TimeWindow1,'time','symmetric');

[absorption, Impedance] = deal(itaAudio(nMeasurements,1));

nChannels = rawData_win(1).nChannels;
if isfield(inStruct, 'geometry')
    KindOfTube = inStruct.geometry;
else
    if nChannels == 3
        KindOfTube = questdlg('Which tube have you used?','Kind of tube', 'smallTubeITA Mics123', 'Big Kundt''s Tube at ITA', 'Rohr mit Ohr' ,'smallTubeITA Mics123');
    else
        KindOfTube = 'smallTubeITA Mics1234';
    end
end
wbh = waitbar(0,'Create protocol...');
gesWaitbar = nMeasurements + smooth_reps;

for iMeasurement = 1:nMeasurements
    [Impedance(iMeasurement), Refl] = ita_kundt_calc_impedance(rawData_win(iMeasurement) , KindOfTube , temp, humidity);
    absorption(iMeasurement) = 1 - abs(Refl)^2 ;

%     absorption(iMeasurement).channelNames = {strrep(inStruct.files{iMeasurement}, '_rawMeasurment.ita', '')};
      absorption(iMeasurement).channelNames = {rawData_win(iMeasurement).comment};
    waitbar(iMeasurement/gesWaitbar, wbh, 'calculate absorption');
end
absorption = absorption.merge;
absorption.comment = 'Absorption';


Impedance = Impedance.merge;
Impedance.channelNames = absorption.channelNames;
ita_write(Impedance, [probeFileName '_Impedance.ita'], 'overwrite')


% export absorption without smoothing
absorption.allowDBPlot = false;
absorption.plotAxesProperties = { 'xlim',[20 10000],'ylim',[-0.1 1.1]};
ita_write(absorption, [probeFileName '_noSmooth.ita'], 'overwrite')


%% from Martin Guski (2012-06-01) optional impedance polt
boolPlotImpedance = 0;
if boolPlotImpedance == 1 
    impSmooth = absorption;
    if ~isempty(smooth)
        for idsmooth = 1:smooth_reps
            impSmooth = ita_smooth(imp, 'LogFreqOctave1', ita_str2num( smooth )/ smooth_reps, 'Complex');
        end
    end
    impSmooth.channelUnits(:) = {'kg/s*m^2'};
    
    reUndImGetrennt = itaAudio(2);
    reUndImGetrennt(1) = ita_real(impSmooth);
    reUndImGetrennt(2) = ita_imag(impSmooth);
    
    nameCell = {'real' 'imag'};
    
    for i=1:2
        
        % plot
        impMean = ita_mean(reUndImGetrennt(i));
        impStd  = ita_std(reUndImGetrennt(i));
        
        
        fgh = figure;
        color = colormap; % Same color as plot before
        color = color(1,:);
        
        impMean.plotLineProperties = {'Color',color};
        ita_plot_freq(impMean,'nodb','xlim',x_lim,'figure_handle', fgh, 'linewidth', lWidthMean);
        
        pltstd = merge(impMean + impStd,impMean - impStd );
        pltstd.plotLineProperties = {'LineStyle','--','Color',color};
        %     fgh = ita_plot_freq(pltstd,'nodb','xlim',x_lim,'ylim',y_lim,'figure_handle',fgh,'hold','on', 'linewidth', lWidthStd);
        
        
        % imp
        fgh = ita_plot_freq(pltstd,'nodb','xlim',x_lim,'figure_handle',fgh,'hold','on', 'linewidth', lWidthStd);
        
        lgh = legend({nameDerProbe},'Interpreter','none', 'location', 'northwest');
        set(gca, 'TickDir', 'out', 'box', 'off')
        probeFileName = [strrep(nameDerProbe, ' ','_'),  '_' nameCell{i} '_mean(' num2str(nMeasurements) ')' ];
        
        if i ==2
            ylim([-1 1]* 5000)
        end
        %     title('')
        ylabel(sprintf('%s(impedance) [%s]',nameCell{i}, impMean.channelUnits{1} ))
        ita_saveplot('aspectRatio',0.5 , 'filename', probeFileName, 'figures', fgh, 'exportPNG', true)
%         close(fgh)
    end
    
end
%% SMOOTH


absSmooth = absorption;
if ~isempty(smooth)
    
    % absSmooth.freqData(1:absSmooth.freq2index(100), :) = 0;
    % ita_verbose_info('Freq < 60 Hz werden zu Null gesetzt!',0)
    
    for idxSmooth = 1:smooth_reps
        waitbar((nMeasurements+idxSmooth)/gesWaitbar, wbh, sprintf('smoothing %i / %i',idxSmooth, smooth_reps));
        absSmooth = ita_smooth(absSmooth, 'LogFreqOctave1', ita_str2num( smooth )/ smooth_reps, 'Real');
    end
    waitbar((nMeasurements+idxSmooth)/gesWaitbar, wbh, '');
    
    % save abs as itaResult
    absSmoothResult = itaResult(absSmooth);
    absSmoothResult.allowDBPlot = false;
    absSmoothResult.plotAxesProperties = { 'xlim',[20 10000],'ylim',[-0.1 1.1]};
    ita_write(absSmoothResult, [probeFileName '_smooth.ita'], 'overwrite')
    
end

%% mean & std: plot and save image
absMean = ita_mean(absSmooth);
absStd  = ita_std(absSmooth);


%% terzen der std exportieren
% % % thirdOctAlpha = ita_spk2frequencybands(absMean,'bandsPerOctave',3,'method','averaged','freqRange',x_lim);
% % % thirdOctAlphaStd = ita_spk2frequencybands(absStd,'bandsPerOctave',3,'method','averaged','freqRange',x_lim);
% % % exportData = [{'Name:', inStruct.nameDerProbe ''; '' '' ''; 'Freq', 'Mean' 'std'}; num2cell([thirdOctAlpha.freqVector thirdOctAlpha.freqData thirdOctAlphaStd.freqData])];
% % % tmpPath = 'D:\tmp';
% % % xlswrite(fullfile(tmpPath, probeFileName), exportData)
% % % movefile(fullfile(tmpPath, [probeFileName ,'.xls']), fullfile(pathName, [probeFileName ,'.xls']))
% % % return

fgh = figure;
color = colormap; % Same color as plot before
color = color(1,:);

absMean.plotLineProperties = {'Color',color};
ita_plot_freq(absMean,'nodb','xlim',x_lim,'ylim',y_lim,'figure_handle', fgh, 'linewidth', lWidthMean, 'linfreq', linFreq);
%ita_plot_freq(absMean,'nodb','figure_handle', fgh, 'linfreq', linFreq);

pltstd = merge(absMean + absStd,absMean - absStd );
pltstd.plotLineProperties = {'LineStyle','--','Color',color};
fgh = ita_plot_freq(pltstd,'nodb','figure_handle',fgh,'hold','on', 'linewidth', lWidthStd, 'linfreq', linFreq);
%fgh = ita_plot_freq(pltstd,'nodb','figure_handle',fgh,'hold','on', 'linfreq', linFreq);

% imp
% ita_plot_cmplx(absMean,'nodb','ylim',y_lim,'figure_handle', fgh, 'linewidth', lWidthMean);
% fgh = ita_plot_cmplx(pltstd,'nodb','xlim',x_lim,'figure_handle',fgh,'hold','on', 'linewidth', lWidthStd);

legend({nameDerProbe},'Interpreter','none', 'location', 'best');



set(gca, 'TickDir', 'out', 'box', 'off')
% lWidth = 1.5;
% lines=findobj(gca,'type','line');
% set(lines,'LineWidth',lWidth)
% set(gca, 'LineWidth', 3)


set(fgh, 'position', [0 0 750 350])
axis([x_lim y_lim ])
ita_savethisplot(fgh,  grafikName, 'resolution', 300)
close(fgh)

%% calc third octave values

absMean2 = absMean;
absMean2.freqData([1:absMean2.freq2index(20) absMean2.freq2index(8000):end],:) = nan;
thirdOctAlpha = ita_spk2frequencybands(absMean2,'bandsPerOctave',3,'method','averaged','freqRange',[100 8000]);

%% fill in the latex template

keyValueCell   = { '<\itaBriefkopfBild>' protocolHeaderPNG;
    '<\datumDerMessung>' datumDerMessung;
    '<\nameDesPruefers>' nameDesPruefers
    '<\temperaturInGradC>' temperatur
    '<\luftfeuchtigkeit>'  luftfeuchtigkeit
    '<\nameDerProbe>'  nameDerProbe
    '<\anzahlDerMessungen>' num2str(nMeasurements)
    '<\samplesOderWiederholungen>'  samplesOderWiederholungen
    '<\dateinameGrafik>'  grafikName
    '<\smoothParameter>'  smooth
    '<\beschreibungDesMaterials>'  beschreibungDerProbe
    '<\terzWertA>' sprintf('%1.2f', thirdOctAlpha.freqData(1))
    '<\terzWertB>' sprintf('%1.2f', thirdOctAlpha.freqData(2))
    '<\terzWertC>' sprintf('%1.2f', thirdOctAlpha.freqData(3))
    '<\terzWertD>' sprintf('%1.2f', thirdOctAlpha.freqData(4))
    '<\terzWertE>' sprintf('%1.2f', thirdOctAlpha.freqData(5))
    '<\terzWertF>' sprintf('%1.2f', thirdOctAlpha.freqData(6))
    '<\terzWertG>' sprintf('%1.2f', thirdOctAlpha.freqData(7))
    '<\terzWertH>' sprintf('%1.2f', thirdOctAlpha.freqData(8))
    '<\terzWertI>' sprintf('%1.2f', thirdOctAlpha.freqData(9))
    '<\terzWertJ>' sprintf('%1.2f', thirdOctAlpha.freqData(10))
    '<\terzWertK>' sprintf('%1.2f', thirdOctAlpha.freqData(11))
    '<\terzWertL>' sprintf('%1.2f', thirdOctAlpha.freqData(12))
    '<\terzWertM>' sprintf('%1.2f', thirdOctAlpha.freqData(13))
    '<\terzWertN>' sprintf('%1.2f', thirdOctAlpha.freqData(14))
    '<\terzWertO>' sprintf('%1.2f', thirdOctAlpha.freqData(15))
    '<\terzWertP>' sprintf('%1.2f', thirdOctAlpha.freqData(16))
    '<\terzWertQ>' sprintf('%1.2f', thirdOctAlpha.freqData(17))
    '<\terzWertR>' sprintf('%1.2f', thirdOctAlpha.freqData(18))
    '<\terzWertS>' sprintf('%1.2f', thirdOctAlpha.freqData(19))
    '<\terzWertT>' sprintf('%1.2f', thirdOctAlpha.freqData(20))};


ita_fillInTemplate(templateFileName, keyValueCell, texFileName);
fclose('all');



% kopieren scheint einfacher als latex pfade mit leerzeichen erklren...
[stat res] = system(['copy "' [protocolPath protocolHeaderPNG] '" ']);


% create pdf
if ita_preferences('verboseMode') == 2
     system([texpath ' ' texFileName]) % mit ausgabe
 else
     [status result] = system([texpath ' ' texFileName]); % ohne ausgabe zur console
     if status
         error(result)
     end
end



close(wbh);
% 
% lscht berflssige Dateien
%  try
%      open([probeFileName '.pdf']);
     delete(protocolHeaderPNG);
     delete([probeFileName '.log'] );
     delete([probeFileName '.aux'] );
     if exist([probeFileName '.bbl'], 'file')~=0
         delete([probeFileName '.bbl']);
     end
     if exist([probeFileName '.blg'],'file')~=0
         delete([probeFileName '.blg'] );
     end
     
     % TODO: Order in itaToolbox wo Template und header dring liegt
%  catch %#ok<CTCH>
%      warning('Please, insert your path of miktex in linie 33. In addition there could be difficulties with your tex file. Please try to compile it separately.') %#ok<WNTAG>
%  end
 
 if delTexFile
     delete(texFileName);
 end
 if delPictureFile
     delete([probeFileName '.png']);
 end
 %if nargout==1
   %  outStruct.pathName         = pathName;
  %   outStruct.files            = files;
  %   outStruct.nameDerProbe     = nameDerProbe;
  %   outStruct.temperatur = temperatur;
  %   outStruct.luftfeuchtigkeit = luftfeuchtigkeit;
   %  outStruct.beschreibungDerProbe = beschreibungDerProbe;
   %  outStruct.protocolLanguage   = protocolLanguage;
   %  outStruct.linFreq            = linFreq;
   %  outStruct.sampleOderWiederholungen = samplesOderWiederholungen;
   %  outStruct.delPicture = delPictureFile;
   %  outStruct.delTexFile = delTexFile;
   %  outStruct.smooth         = smooth;
   %  outStruct.smootheReps    = smooth_reps;
   %  outStruct.nameDesPruefers = nameDesPruefers;
   %  outStruct.texpath = texpath;
   %  varargout{1}=outStruct;
 end