clc
close all
clear

    d = dir('*.csv');
    
for i = length(d):-1:1
    Dstr_max_structure(i).name = d(i).name;
    Dstr_max_structure(i).matrix = csvread(d(i).name);
    
    M = Dstr_max_structure(i).matrix;
    
    if (size(M,2) == 3)
        
    figure;
    subplot(2,1,1);
    plot( M(:,1) - M(1,1), M(:,2) );
    strpos = strcat(d(i).name,' sensor ');
    legend(strpos); 
    subplot(2,1,2); 
    plot( M(:,1) - M(1,1), M(:,3) );
    strforce = strcat(d(i).name, ' angle ');
    legend(strforce)
    
    end
    
    if (size(M,2) == 4)
        
    figure;
    subplot(3,1,1);
    plot( M(:,1) - M(1,1), M(:,2) );
    strpos = strcat(d(i).name,' sensor ');
    legend(strpos); 
    subplot(3,1,2); 
    plot( M(:,1) - M(1,1), M(:,3) );
    strforce = strcat(d(i).name, ' angle ');
    legend(strforce)
    subplot(3,1,3); 
    plot( M(:,1) - M(1,1), M(:,4) );
    strtorque = strcat(d(i).name, ' torque ');
    legend(strtorque)
    
    end
    
    if (size(M,2) == 5)
        
    figure;
    subplot(4,1,1);
    plot( M(:,1) - M(1,1), M(:,2) );
    strpos = strcat(d(i).name,' sensor ');
    legend(strpos); 
    subplot(4,1,2); 
    plot( M(:,1) - M(1,1), M(:,3) );
    strforce = strcat(d(i).name, ' angle ');
    legend(strforce)
    subplot(4,1,3); 
    plot( M(:,1) - M(1,1), M(:,4) );
    strtorque = strcat(d(i).name, ' torque ');
    legend(strtorque)
    subplot(4,1,4);
    plot( M(:,1) - M(1,1), M(:,5) );
    strtorque = strcat(d(i).name, ' oposed sensor ');
    legend(strtorque)
    
    end
    
end