please solve the below error
1 次查看(过去 30 天)
显示 更早的评论
Error using load
Unable to read file 'repressilator_oscillations.dat'. No such file or directory.
Error in repressilatorstocha>letsgo (line 25)
D=load('repressilator_oscillations.dat');
Error in repressilatorstocha (line 7)
letsgo
PROGRAM:function repressilatorstocha;
%%%Repressilator - Gillespie
clc;
letsgo
%------------------------------------------------------------
% Let's go
%------------------------------------------------------------
function letsgo
set(figure(1),'Position', [200 100 800 800]);
clf;
nrun=10;
nrunout=5;
tend=200;
ysc=100;
%%%initial condition
D=load('repressilator_oscillations.dat');
DCOL2=D(:,2);
k=find(DCOL2==min(DCOL2));
CI=D(k,:); % This CI corresponds to min of m1
%%%run and plot
subplot(3,2,1);
omega=100;
fprintf('Run simulation for omega = %g \n ',omega);
for i=1:nrun % nruns runs
fprintf('.');
D=runrepressilator(omega,tend,CI);
if i==1
DM=D;
else
DM=DM+D(1:length(DM),:);
end
if i<=nrunout
plot(D(:,1),D(:,2),'b');
hold on;
end
end
fprintf('\n\n');
DM=DM/nrun;
xlim([0 50])
ylim([0 ysc*omega])
xlabel('Time','fontsize',16);
ylabel('m_1 for each cell','fontsize',16);
text(0, ysc*omega+ysc*omega/10,'(A)','fontsize',18);
subplot(3,2,2);
plot(DM(:,1),DM(:,2),'b'); % average
xlim([0 tend])
ylim([0 ysc*omega])
xlabel('Time','fontsize',16);
ylabel('m_1 mean','fontsize',16);
subplot(3,2,3);
omega=10;
fprintf('Run simulation for omega = %g \n ',omega);
for i=1:nrun % nruns runs
fprintf('.');
D=runrepressilator(omega,tend,CI);
if i==1
DM=D;
else
DM=DM+D(1:length(DM),:);
end
if i<=nrunout
plot(D(:,1),D(:,2),'b');
hold on;
end
end
fprintf('\n\n');
DM=DM/nrun;
xlim([0 50])
ylim([0 ysc*omega])
xlabel('Time','fontsize',16);
ylabel('m_1 for each cell','fontsize',16);
text(0, ysc*omega+ysc*omega/10,'(B)','fontsize',18);
subplot(3,2,4);
plot(DM(:,1),DM(:,2),'b'); % average
xlim([0 tend])
ylim([0 ysc*omega])
xlabel('Time','fontsize',16);
ylabel('m_1 mean','fontsize',16);
subplot(3,2,5);
omega=1;
fprintf('Run simulation for omega = %g \n ',omega);
for i=1:nrun % nruns runs
fprintf('.');
D=runrepressilator(omega,tend,CI);
if i==1
DM=D(1:length(D)-10,:); % trick to have data matrix of same size
else
DM=DM+D(1:length(DM),:);
end
if i<=nrunout
plot(D(:,1),D(:,2),'b');
hold on;
end
end
fprintf('\n\n');
DM=DM/nrun;
xlim([0 50])
ylim([0 ysc*omega])
xlabel('Time','fontsize',16);
ylabel('m_1 for each cell','fontsize',16);
text(0, ysc*omega+ysc*omega/10,'(C)','fontsize',18);
subplot(3,2,6);
plot(DM(:,1),DM(:,2),'b'); % average
xlim([0 tend])
ylim([0 ysc*omega])
xlabel('Time','fontsize',16);
ylabel('m_1 mean','fontsize',16);
%------------------------------------------------------------
% Run
%------------------------------------------------------------
function results=runrepressilator(omega,tend,CI);
% Parameters:
a0=0*omega;
a=100*omega;
b=5;
g=5;
nn=2;
k=1*omega^nn;
% Initial conditions:
m1=round(CI(2)*omega);
m2=round(CI(3)*omega);
m3=round(CI(4)*omega);
p1=round(CI(5)*omega);
p2=round(CI(6)*omega);
p3=round(CI(7)*omega);
v=[m1 m2 m3 p1 p2 p3];
% Time:
trans=0;
%tend=20;
tech=0.2;
% Initialisation:
t=0;
results=[];
told=0;
% Run Gillespie loop:
while (t<tend+trans)
m1=v(1);
m2=v(2);
m3=v(3);
p1=v(4);
p2=v(5);
p3=v(6);
w(1)=m1;
w(2)=m2;
w(3)=m3;
w(4)=a*k/(k+p3^nn);
w(5)=a*k/(k+p1^nn);
w(6)=a*k/(k+p2^nn);
w(7)=a0;
w(8)=a0;
w(9)=a0;
w(10)=b*m1;
w(11)=b*m2;
w(12)=b*m3;
w(13)=g*p1;
w(14)=g*p2;
w(15)=g*p3;
c(1)=w(1);
for j=2:15;
c(j)=c(j-1)+w(j);
end
ct=c(15);
z1=rand();
z2=rand();
tau=(-log(z1))/ct;
uct=z2*ct;
tm1=0;
tm2=0;
tm3=0;
tp1=0;
tp2=0;
tp3=0;
if (uct<c(1))
tm1=-1.0;
elseif ((uct>c(1)) & (uct<c(2)))
tm2=-1.0;
elseif ((uct>c(2)) & (uct<c(3)))
tm3=-1.0;
elseif ((uct>c(3)) & (uct<c(4)))
tm1=1.0;
elseif ((uct>c(4)) & (uct<c(5)))
tm2=1.0;
elseif ((uct>c(5)) & (uct<c(6)))
tm3=1.0;
elseif ((uct>c(6)) & (uct<c(7)))
tm1=1.0;
elseif ((uct>c(7)) & (uct<c(8)))
tm2=1.0;
elseif ((uct>c(8)) & (uct<c(9)))
tm3=1.0;
elseif ((uct>c(9)) & (uct<c(10)))
tp1=1.0;
elseif ((uct>c(10)) & (uct<c(11)))
tp2=1.0;
elseif ((uct>c(11)) & (uct<c(12)))
tp3=1.0;
elseif ((uct>c(12)) & (uct<c(13)))
tp1=-1.0;
elseif ((uct>c(13)) & (uct<c(14)))
tp2=-1.0;
elseif ((uct>c(14)) & (uct<c(15)))
tp3=-1.0;
end
tv=[tm1 tm2 tm3 tp1 tp2 tp3];
t=t+tau;
v=v+tv;
if (t>trans) && (t>told+tech)
results=[results ; t-trans v];
told=t;
end
end % end of while
0 个评论
回答(1 个)
Guillaume
2018-6-18
Unable to read file 'repressilator_oscillations.dat'. No such file or directory.
What more is there to say? You try to load a file which does not exist. There's nothing we can do about that.
4 个评论
Guillaume
2018-6-18
The .dat file should contain some data. From the code, it looks like it should contain two columns of numbers. You would be better off asking the author. Since there is no comment in the code, only he/she knows how it's supposed to work.
Note that the code is of poor quality and just after a short look I can already see several ways in which it could error.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!