%template file for running BioNetGen simulations from Matlab

%In order to use the runbng function, you need to add to Matlab path 
%the directories containing the BioNetGen installation.  Make sure you save
%the path before exiting Matlab so that you don't need to add the
%directories again in the future.

%Note, the first time you run the runbng function, a window will pop up and
%ask you to give the location of the file BNG2.pl

%Change the current directory to your RuleBender project directory
for i = 1:10 %run 10 simulations
    runbng('PAR','PAR.bngl'); %execute the simulation in the subdirectory PAR
    A = importdata('PAR.gdat',' ',1); %import the data
    time = A.data(:,1); %rename the time vector
    protein = A.data(:,3); %rename the protein vector
    figure(1), hold on
    plot(time,protein,'b')
    pause
end