the code showing error "Error using network/sim (line 271) Input data sizes do not match net.inputs{1}.size. Error in ann (line 40) y1 = sim(net,riii);".How to correct?

3 次查看(过去 30 天)
clear all;
close all;
files={'r1i.mat','r2i.mat','r3i.mat','r4i.mat'};
% s=load ('c1.mat');
% c(:,1)=mfcc';
% files = {'file1.mat', 'file2.mat', 'file3.mat', 'file4.mat'};
S = load(files{1});
for m = 2:numel(files)
S(m,1) = load(files{m});
end
% C=[S(1,1) S(2,1) S(3,1) S(4,1) S(5,1) S(6,1) S(7,1) S(8,1) S(9,1) S(10,1) S(11,1) S(12,1) S(13,1) S(14,1) S(15,1) S(16,1) S(17,1) S(18,1) S(19,1) S(20,1) S(21,1) S(22,1) S(23,1) S(24,1) S(25,1) S(26,1) S(27,1) S(28,1) S(29,1) S(30,1) S(31,1) S(32,1) S(33,1) S(34,1) S(35,1) S(36,1) S(37,1) S(38,1) S(39,1) S(40,1) S(41,1) S(42,1) S(43,1) S(44,1) S(45,1) S(46,1) S(47,1) S(48,1) S(49,1) S(50,1) ];
A= struct2cell(S)';
B= cell2mat(A);
D=B';
t=zeros(2,2);
t(1,1:2)=1;
t(2,1:2)=0;
t(1,3:4)=0;
t(2,3:4)=1;
save D D;
save t t;
% TESTING
% load B.mat;
load t.mat;
ri=load('r1i.mat');
rii=struct2cell(ri);
riii=cell2mat(rii);
% ciiii=ciii';
save riii riii;
load riii.mat;
net = feedforwardnet(10);
net = train(net,D,t);
view(net)
y = net(D);
perf = perform(net,y,t);
y1 = sim(net,riii');
if (y1(1,1)>y1(2,1))
o=1;
elseif (y1(2,1)>y1(1,1))
o=2;
end
if o==1
disp('Elephant is present');
elseif o==2
disp('Elephant is not present ');
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by