clear variables
close all
clc

filename = 'SimData';
measurename = ('Chlazeni2');
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

j = 1;

measurenames{j} = ('Chlazeni_50_2');
j = j+1;

measurenames{j} = ('Chlazeni2');
j = j+1;

measurenames{j} = ('Ventilatory');
j = j+1;

measurenames{j} = ('Topeni100');
j = j+1;

measurenames{j} = ('Svetla10');
j = j+1;

measurenames{j} = ('Chlazeni50svetla50');


for i = 1:length(measurenames)
    measurename = measurenames{i};
    filepath = strcat('SimData/', measurename, '.mat');
    index = 1;
    if exist(filepath,'file') == 2;
        load (filepath);

        %   chlazeni
        if ~exist('chlazeni', 'var')
           chlazeni = {0, 0, 0};
        end
        addvartoxls( chlazeni, 'chlazeni', index, filename, measurename )
        index = index + 1;

        %   endtime
        if ~exist('endtime', 'var')
           endtime = 0;
        end
        addvartoxls( endtime, 'endtime', index, filename, measurename )
        index = index + 1;

        %   osvetleni
        if ~exist('osvetleni', 'var')
           osvetleni = {0, 0, 0};
        end
        addvartoxls( osvetleni, 'osvetleni', index, filename, measurename )
        index = index + 1;

        %   simtime
        if ~exist('simtime', 'var')
           simtime = 0;
        end
        addvartoxls( simtime, 'simtime', index, filename, measurename )
        index = index + 1;

        %   T_out
        if ~exist('T_out', 'var')
           T_out = 21.5;
        end
        addvartoxls( T_out, 'T_out', index, filename, measurename )
        index = index + 1;

        %   topeni
        if ~exist('topeni', 'var')
           topeni = {0, 0, 0};
        end
        addvartoxls( topeni, 'topeni', index, filename, measurename )
        index = index + 1;

        %   ventil
        if ~exist('ventil', 'var')
           ventil = {0, 0, 0};
        end
        addvartoxls( ventil, 'ventil', index, filename, measurename )
        index = index + 1;
    end
end
