bug随记
找了一下午硬是没找到错在哪里了。
还以为是软件问题了,差点卸载去重新安装Matlab2019了。
Talk is Cheap.Show me the code.
load('Protein_complex_known.mat')
load('protein_total.mat');
load('DC_value.mat')
k=protein_total{1763,1};
t=0.0;
d_gree=full(d_gree);
disp(t);
for i=1:745
idx=ismember(Protein_complex_known{1,i}, k);
if sum(idx)~=0%如果这一个单位内有k元素,进入下一步
for j=1:length(idx)
if idx(1,j)==0
[m,n]=find(strcmp(protein_total,Protein_complex_known{1,i}{1,j}));
tt=d_gree(1,m);
t=t+tt;
disp(tt);
end
end
disp(t);
disp("over");
end
end
disp(t);
上面的是错误代码,最后没有输出,因为结果为空。差点以为是软件问题了。
其实是没想到find结果会为空,以为所有的ID都可以被找到,加了一个isempty就行了~~~~o(╥﹏╥)o
load('Protein_complex_known.mat')
load('protein_total.mat');
load('DC_value.mat')
k=protein_total{1763,1};
t=0.0;
d_gree=full(d_gree);
disp(t);
for i=1:745
idx=ismember(Protein_complex_known{1,i}, k);
if sum(idx)~=0%如果这一个单位内有k元素,进入下一步
for j=1:length(idx)
if idx(1,j)==0
[m,n]=find(strcmp(protein_total,Protein_complex_known{1,i}{1,j}));
if ~isempty(m)
tt=d_gree(1,m);
t=t+tt;
disp(tt);
end
end
end
disp(t);
disp("over");
end
end
disp(t);
本文系作者 @rinbn 原创发布在 噓だ。未经许可,禁止转载。
Полезно
excelente artículo.
It was fun to read your article. Shandy Perice Hedley