clf
clear all

%=============================================
%build the GUI
%define the plot button
plotbutton=uicontrol('style','pushbutton',...
   'string','Run', ...
   'fontsize',12, ...
   'position',[100,400,50,20], ...
   'callback', 'run=1;');

%define the stop button
erasebutton=uicontrol('style','pushbutton',...
   'string','Stop', ...
   'fontsize',12, ...
   'position',[200,400,50,20], ...
   'callback','freeze=1;');

%define the Quit button
quitbutton=uicontrol('style','pushbutton',...
   'string','Quit', ...
   'fontsize',12, ...
   'position',[300,400,50,20], ...
   'callback','stop=1;close;');

number = uicontrol('style','text', ...
    'string','1', ...
   'fontsize',12, ...
   'position',[20,400,50,20]);
    
% Number of cells in the grid

n=15;

%initialize the arrays
z = zeros(n,n);

notchActThresh = 0.995;  % Notch activity threshold above which the cell has high Notch activity

gridCells = z;  % these are the states of cells on the display 
                % red = high Notch value and black is low Notch activity 

%Initialize the grid cells corresponding to Notch activity in cellsNotch 
CellsNotch = ; %your values matrix for Notch

gridCells = (cellsNotch >= notchActThresh);

%build an image and display it
imh = image(cat(3,gridCells,z,z));
set(imh, 'erasemode', 'none')
axis equal
axis tight


%Main event loop
stop= 0; %wait for a quit button push
run = 0; %wait for a draw 
freeze = 0; %wait for a freeze


while (stop==0) 
    
    if (run==1)
       
     
        % Grid rule 
            
        % Draw the new image
        set(imh, 'cdata', cat(3,gridCells,z,z) )
        
        % Update the step number display
        stepnumber = 1 + str2num(get(number,'string'));
        set(number,'string',num2str(stepnumber))
        
        
    end
    
    if (freeze==1)
        run = 0;
        freeze = 0;
    end
    
    drawnow  %need this in the loop for controls to work
    
end

  
    
