%% Load matlab format VICON

clear all;close all


cd /home/shared/essua/matlab
clear all;close all;clc

load 'data_in_labeling.mat';
out_folder = '/home/data/vicon_rosado_full';
precision = '%.3f';

%% Write VICON to disk in c++ readable way

fprintf('Saving VICON data as txt ... \n')
for k=1:length(tags)
    
    if strncmp(tags(k),'t.L',3)
        %Uncorrect label
        continue
    end

    tag = char(tags(k));
    tag = tag(3:end);
    
    out_file = fullfile(out_folder,[tag '.txt']);
    
    eval(sprintf('dlmwrite(''%s'',%s'',''delimiter'','' '',''precision'',''%s'')',out_file,char(tags(k)),precision))
    fprintf('%.1f%% \n',k/length(tags)*100);
end

fprintf('done.\n')
