Error when using ==> plot3 Conversion to double from cell is not possible. plot3 (p (1, :), p (2, :), p (3, :), '+ r');

I am trying to call the contention layer on the kdd dataset, but I am getting this:

???Error using ==> plot3 Conversion to double from cell is not possible. plot3(p(1,:),p(2,:),p(3,:),'+r');

      

Here is my code:

clear all;
p=importdata('kdd train.txt');
tar=[];
for i=0:size(p);
    tar=[tar;0 1];
end
net=newc(tar,5,0.1);
w = net.IW{1};
plot3(p(1,:),p(2,:),p(3,:),'+r');
grid on;
hold on;
circles = plot3(w(:,1),w(:,2),w(:,3),'ob');
net.trainParam.epochs = 10;
net = train(net,p);
w = net.IW{1};
delete(circles);
plot3(w(:,1),w(:,2),w(:,3),'ob');

      

Can anyone see what is causing the error?

+3


source to share


1 answer


The error says the variable is p

supposed to be converted to a double from a cell, so I'm assuming it p

is a cell array, not a numeric matrix. Try converting it using cell2mat

:



 p=cell2mat(p);

      

+1


source







All Articles