function [ ] = data_save( data_meas, data_sim, data_meas_title, measurename )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
filename = strcat('Grafy/', measurename,'.xlsx');

alphabet = {'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' 'AA' 'AB' 'AC' 'AD'};
%% meas
T_vz = 60; %   pozadovana perioda vzorkovani
endtime = data_meas(end, 1);

time = (0:T_vz:endtime)';

data_modified = zeros(length(time), size(data_meas, 2));

for i = 1:length(time)
    [j, ~] = find(data_meas(:, 1) >= time(i), 1);
    data_modified(i, :) = data_meas(j, :);
end

data_modified(:, 1) = time;
data_meas = data_modified;
%% sim
T_vz = 60; %   pozadovana perioda vzorkovani
endtime = data_sim(end, 1);

time = (0:T_vz:endtime)';

data_modified = zeros(length(time), size(data_sim, 2));

for i = 1:length(time)
    [j, ~] = find(data_sim(:, 1) >= time(i), 1);
    data_modified(i, :) = data_sim(j, :);
end

data_modified(:, 1) = time;
data_sim = data_modified;


%% headline
data = [zeros(size(data_meas)) zeros(size(data_meas))];

for i = 1:1:(length(data_meas_title))
Headline(i*2-1) = strcat(data_meas_title(i), '_m');
Headline(i*2) = strcat(data_meas_title(i), '_s');

data(:, i*2-1) = data_meas(:, i);
data(:, i*2) = data_sim(:, i);
end

xlswrite(filename, Headline);
xlsindex = strcat('A', num2str(2), ':', alphabet{length(Headline)}, num2str(length(data_sim)+1));
xlswrite(filename, data, xlsindex);