Hi, guys,
I just started to delve in the PCT of MATLAB. My code is a bit lengthy, so I would only place here the part that has caused " Brace indexing is not supported for variables of this type." error. The following is the snippet:
parpool(nb);
spmd
…
dataReceived = [ ]; % Create a buffer for the received data
NBRList = nodeNeighbors{labindex}; % The neighbor list of Agent labindex. E.g., labindex = 2, and it has neighbors 1 and 6; then NBRList = [ 1, 6 ]. NBRList is of % composite type while nodeNeighbors is of cell array type.
NBRLenth = length(NBRList); % Agent labindex's no. of neighbors
for i=1:NBRLenth
kPos =find(nodeID{NBRList(i)}==labindex); % Get where labindex lies in NBRList(i)'s neighbor list. nodeID (of cell array type) stores neighbor IDs plus labindex in % an ascending order.
thisBk =Bk{NBRList(i)}; % Composite objects only support simple subscripting, so I used thisBk. The abovementioned error pops up when this statement % is present.
% Send and receive relevant data to and from neighbors.
dataSent = thisBk([kPos, kPos+length(nodeID{NBRList(i)})]);
dataReceived = [dataReceived, labSendReceive(labindex,NBRList(i), dataSent)];
end
end
Thanks for your help!
Best Answer