clear variables
close all
clc
filename = 'Svetla80_new';
data_meas = importdata(strcat('data/', filename, '_puvodni.xlsx'));
datatype = whos('data_meas');
if strcmp(datatype.class, 'struct')
data_meas = data_meas.Sheet1;
end
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;

% figure
% plot(data_meas(:, 1), data_meas(:, 2))
% figure
% plot(time, data_modified(:, 2))
xlswrite(strcat('data/', filename, '_modified.xlsx'), data_modified)