Hi guys
i am programming kuka robot. I would like to obtain datas with arduino. That is why I am usuing paralel functions.However, I have problem and I do not know whether it is about spmd or not.
The error ='"i" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable.
A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval.'
I did not use i as a function but I load variable.mat to call i. Following I add my codes...
function data = main
PointList.PointID = [1,2,3,4,5];
PointList.X = [1000,1100,1200,1250,1300];
PointList.Y = [0,0,0,0,0];
PointList.Z = [1400,1450,1455,1470,1500];
PointList.A = [-159.84,-159.84,-159.84,159.84,159.84];
PointList.B = [89.93,89.93,90,98,98];
PointList.C = [-160.05,160.05,160.05,160.05,160.05];
funList = {@fun1,@fun2};
dataList = {PointList,PointList};
matlabpool ('local',2)
spmd
labBarrier
Daten1 = funList{labindex}(dataList{labindex});
end
data = {Daten1{:}};
and now fun 1
function [PointID] = fun1(PointList)
...
load variablen_1
...
if posreached (RIst, RSol, i) == 1
Counter = IPOC(i);
while IPOC(i) < Counter+2000
Ein=H.Ein(2);
Aus=H.Aus(1);
reply = ['<Sen Type="ImFree"><EStr>' Msg '</EStr>'...
'<Tech T21="0.0" T22="0.0" T23="0.0" T24="0.0" T25="0.0" T26="0.0" T27="0.0" T28="0.0" T29="0.0" T210="0.0" />'...
'<Pos X="' num2str(X) '" Y="' num2str(Y) '" Z="' num2str(Z) '"'...
'A="' num2str(A) '" B="' num2str(B) '" C="' num2str(C) '"/>'...
'<Speed>' num2str(speed) '</Speed><Waittime>' num2str(waittime) '</Waittime>'...
'<Mode>' num2str(mode) '</Mode><Point_ID>' num2str(hPoint) '</Point_ID>'...
'<Spindel Ein="' num2str(Ein) '" Aus="' num2str(Aus) '"/>'...
'<Drehzahl>' num2str(Drehzahl) '</Drehzahl>'...
'<IPOC>' num2str(RIst.IPOC(end)) '</IPOC></Sen>' ];
fwrite(con,double(reply));
i=i+1;
end
i cut some codes. As you see I used i as an input in another function too. I did not get any errors on these lines just on i=i+1
Do you have any idea?
Thanxx