function [PathExist,Lout] = FindCoordPath(L,r,c)
%Determine if percolation occurs on the input level set by testing each
%point in the top row for a path to the bottom row
%
%INPUTS
%  L/Lat = Level set/Lattice with 1s and 0s representing melt ponds and 
%          sea ice
%      r = Number of rows in L (1000 for continuum model data)
%      c = Number of columns in L (1000 for continuum model data)
%
%OUTPUTS
%  Out = 
%
%By: Anthony Cheng (Mar 2015)
%===================================================================

%Declare global Lat so iterations of the input x from 1 to c are "recorded"
%on the same variable 
global Lat;
Lat = L;

%For every point across the "top" (first row) of the image, try to find a 
%path to the bottom of the image. 
for x = 1:c
    y = 1;
    PathExist = CoordTraverseStack(x,y,r,c);
    if PathExist > 0
        break
    else
    end
end

Lout = Lat;
end