matlab定义函数function[r] = MCT(a1,a2);[m,n]=size(a1);clv1=zeros(1,15);clv2=zeros(1,15);for i=1:m for j =1:n b1(j)=a1(i,j); b2(j)=a2(i,j); end clv1(i)=4*b1(1)+2*b1(2)+b1(3)+b1(4)+b1(5)-b1(6)-b1(7)-b1(8)-b1(9); clv2(i)=4
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 17:32:59
matlab定义函数function[r] = MCT(a1,a2);[m,n]=size(a1);clv1=zeros(1,15);clv2=zeros(1,15);for i=1:m for j =1:n b1(j)=a1(i,j); b2(j)=a2(i,j); end clv1(i)=4*b1(1)+2*b1(2)+b1(3)+b1(4)+b1(5)-b1(6)-b1(7)-b1(8)-b1(9); clv2(i)=4
matlab定义函数
function[r] = MCT(a1,a2);
[m,n]=size(a1);
clv1=zeros(1,15);
clv2=zeros(1,15);
for i=1:m
for j =1:n
b1(j)=a1(i,j);
b2(j)=a2(i,j);
end
clv1(i)=4*b1(1)+2*b1(2)+b1(3)+b1(4)+b1(5)-b1(6)-b1(7)-b1(8)-b1(9);
clv2(i)=4*b2(1)+2*b2(2)+b2(3)+b2(4)+b2(5)-b2(6)-b2(7)-b2(8)-b2(9);
end
clv1
clv2
pause;%step 1 complete(clv1&clv2)
一运行就说
? Error: File: mct.m Line: 31 Column: 1
Function definitions are not permitted at the prompt or in scripts.
求高人指导下啊~急求你了做出来我把左右分都给你
matlab定义函数function[r] = MCT(a1,a2);[m,n]=size(a1);clv1=zeros(1,15);clv2=zeros(1,15);for i=1:m for j =1:n b1(j)=a1(i,j); b2(j)=a2(i,j); end clv1(i)=4*b1(1)+2*b1(2)+b1(3)+b1(4)+b1(5)-b1(6)-b1(7)-b1(8)-b1(9); clv2(i)=4
a1=rand(10,10);a2=rand(10,10); [m,n]=size(a1); clv1=zeros(1,15); clv2=zeros(1,15); for i=1:m for j =1:n b1(j)=a1(i,j); b2(j)=a2(i,j); end clv1(i)=4*b1(1)+2*b1(2)+b1(3)+b1(4)+b1(5)-b1(6)-b1(7)-b1(8)-b1(9); clv2(i)=4*b2(1)+2*b2(2)+b2(3)+b2(4)+b2(5)-b2(6)-b2(7)-b2(8)-b2(9); end clv1 clv2 怎么这个可以运行?