function fullrank=min_submatrix_rank(A)
%
% input: 20x50 matrix A (selected at random)
%
% output: fullrank = 1 if EVERY 4 columns of A form a linearly independent
% set, fullrank = 0 if linearly dependent

[m,n]=size(A);

nofullrank=0;
fullrank=0;
  
for j1=1:(n-3)
    for j2=(j1+1):(n-2)
        for j3=(j2+1):(n-1)
            for j4=(j3+1):n
                
                if rank(A(:,[j1 j2 j3 j4]))<4
                    nofullrank=1;
                    break
                end
            end
            
            if nofullrank==1
                break
            end
        end
        if nofullrank==1
            break
        end
    end
    if nofullrank==1
        break
    end
end

if nofullrank==0
    fullrank=1;
end


       