% funkce pro načítání dat
function [x_axis, data, len] = dataRead(file_path)

    % získání datového typu souboru
    C = strsplit(file_path,'.');
    file_type = char(C(end));

    % bloky pro jednostlivé datové typy
    switch file_type
        case char('txt')
            data_file = fopen(file_path,'r');
            scaned_data = fscanf(data_file,'%f %f',[2 inf]);
            len = size(scaned_data,2);
            x_axis = scaned_data(1,1:len)';
            data = scaned_data(2,1:len)';
            fclose(data_file);
    
        case char('xlsx')
            scaned_data = xlsread(file_path);
            len = size(scaned_data,1);
            x_axis = scaned_data(1:len,1);
            data = scaned_data(1:len,2);
    
        case char('xls')
            scaned_data = xlsread(file_path);
            len = size(scaned_data,1);
            x_axis = scaned_data(1:len,1);
            data = scaned_data(1:len,2);
    
        case char('csv')
            scaned_data = dlmread(file_path);
            len = size(scaned_data,1);
            x_axis = scaned_data(1:len,1);
            data = scaned_data(1:len,2);
        otherwise
            disp('input file error: unsupported file type');
            x_axis = 0;
            data = 0;
            len = 0;
    end
    
end