Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

plot

matlab

I am trying to call competitive layer on kdd data set, but I'm 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?

like image 628
sai Avatar asked Nov 28 '25 02:11

sai


1 Answers

The error says that for the p variable there suppose to be a conversion to double from cell, so I assume p is a cell array and not a numeric matrix. Try to convert it using cell2mat:

 p=cell2mat(p);
like image 143
bla Avatar answered Nov 30 '25 19:11

bla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!