MATLAB中M文件怎么解决??? Undefined function or variable 'cb'.之类的问题
function[time,cost]=TC%clearall;%clc;Time0=50;Cost0=3500;Time=[7,6,7;3,3,2;2,3,4;20,2...
function[time,cost]=TC
%clear all;
%clc;
Time0=50;
Cost0=3500;
Time=[7,6,7;3,3,2;2,3,4;20,24,0;3,0,0];
Dcost=[8073,9250.66,17384.21;834.72,946.94,1204.41;639.08,1538.16,1550.23;63112.88,45597.53,0;0,0,0];
Icost=3500;%间接成本
indexT=1;
indexC=1;
t=1;
c=1;
for i=1:3
for j=1:3
for k=1:3
for m=1:3
for n=1:3
TIME(indexT)=Time(1,i)+Time(2,j)+Time(3,k)+Time(4,m)+Time(5,n);
if TIME(indexT)<Time0
gq(t)=TIME(indexT);
t=t+1;
end
indexT=indexT+1;
end
end
end
end
end
for i=1:3
for j=1:3
for k=1:3
for m=1:3
for n=1:3
COST(indexC)=Dcost(1,i)+Dcost(2,j)+Dcost(3,k)+Dcost(4,m)+Dcost(5,n);
if COST(indexC)<Cost0
cb(c)=COST(indexC);
c=c+1;
end
indexC=indexC+1;
end
end
end
end
end
time=min(gq);
cost=min(cb)+Icost*time;
运行后总是说??? Undefined function or variable 'cb'.,怎么解决?谢谢大家哈 展开
%clear all;
%clc;
Time0=50;
Cost0=3500;
Time=[7,6,7;3,3,2;2,3,4;20,24,0;3,0,0];
Dcost=[8073,9250.66,17384.21;834.72,946.94,1204.41;639.08,1538.16,1550.23;63112.88,45597.53,0;0,0,0];
Icost=3500;%间接成本
indexT=1;
indexC=1;
t=1;
c=1;
for i=1:3
for j=1:3
for k=1:3
for m=1:3
for n=1:3
TIME(indexT)=Time(1,i)+Time(2,j)+Time(3,k)+Time(4,m)+Time(5,n);
if TIME(indexT)<Time0
gq(t)=TIME(indexT);
t=t+1;
end
indexT=indexT+1;
end
end
end
end
end
for i=1:3
for j=1:3
for k=1:3
for m=1:3
for n=1:3
COST(indexC)=Dcost(1,i)+Dcost(2,j)+Dcost(3,k)+Dcost(4,m)+Dcost(5,n);
if COST(indexC)<Cost0
cb(c)=COST(indexC);
c=c+1;
end
indexC=indexC+1;
end
end
end
end
end
time=min(gq);
cost=min(cb)+Icost*time;
运行后总是说??? Undefined function or variable 'cb'.,怎么解决?谢谢大家哈 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询