function [ r1_matrix_sort, star_1_sort ] = star_one( num_var, r, p, corr_matrix_sort )

% PURPOSE: ASSIGN STARS TO DIFFERENT SIGNIFICANCE LEVELS OF THE COUNTRY LAG 
% AND LEAD CORRELATIONS
% 
% 
% INPUT:
%     -num_var:NUMBER OF VARIABLES
%     -r:CORRELATION
%     -p:PVALUE
%     -corr_matrix_sort:MATRIX CORRELATION AT TIME T=0 SORTED
%     
% OUTPUT:
%     -r1_matrix_sort:PVALUES ORDERED IN ACCORDING TO THE ORDER OF CORRELATION AT TIME T=0
%     -star_1_sort:STARS ORDERED IN ACCORDING TO THE ORDER OF CORRELATION AT TIME T=0


%Recall variables define din the main script
global num_c

    %Create vector with the stars for the different significance levels for
    %correlation at different time horizons
    for i=1:num_c
        for j=1:num_var
            if p(i,j)<.01
                star_1(i,j)= {'***'};
            elseif and(p(i,j)>.01, p(i,j)<.05)
                star_1(i,j)={'**'};
            elseif and(p(i,j)>.05, p(i,j)<.1)
                star_1(i,j)={'*'};
            else
                star_1(i,j)={''};
            end
        end
    end
   
    %Sort values
    for l=1:num_var        
        for k=1:num_c
            for i=1:num_c
                 if i==corr_matrix_sort(k,1,l)
                    r1_matrix_sort(k,1,l)=r(i,l);
                    star_1_sort(k,l)=star_1(i,l);
                 end
            end
        end
    end
    
end


