Matlab训练bp神经网络但报错 ,代码如下

我就写到这里后面的部分还没写,请问有啥问题,其中这个b1.txt里面有30列3行数据,b2.txt有30列1行数据。

FID1=load('b1.txt');
Xuexiyangben=FID1';
FID2=load('b2.txt');
XueDesire=FID2';
FID3=load('b3.txt');
Ceshiyangben=FID3';
FID4=load('b4.txt');
Ceshiqiwang=FID4';
p1=Xuexiyangben';
minp1=min(p1);
maxp1=max(p1);
for j=1:30
    for i=1:3
        xueguiyi(i, j)=(p1(i, j)-minp1(j))/(maxp1(j)-minp1(j));
    end
end
p2=Ceshiyangben';
minip2=min(p2);
minp2=min(p2);
maxp2=max(p2);
for j=1:8
    for i=1:3   
        testguiyi(i, j)=(p2(i, j)-minp2(j))/(maxp2(j)-minp2(j));
    end
end
net=newff(xueguiyi, XueDesire, [6], {'logsig', 'purelin'}); 
net.trainParam.epochs=1000;
net.trainParam.goal=0;
[net, tr]=train(net, xueguiyi, XueDesire);

运行最终会报错说Inputs and targets have different numbers of samples,我如果给XueDesire加转置就会变成Output data size does not match net.outputs{2}.size.

你的p和t需要转置一下,即p=p'; t=t'