here's my code,please tell me where is the error
if
road=unique(M(:,1));
time_slot=unique(M(:,2));
user_id=unique(M(:,3));
n_road=numel(road);
n_time=numel(time_slot);
n_user=numel(user_id);
driver=intersect(user_id,randsample(user_id,100));
A=ones(n_road,100,n_time);
for ii=1:n_road
for jj=1:100
for kk=1:n_time
[r]=find(M(:,1)==road(ii) & M(:,3)==driver(jj) & M(:,2)==time(kk));
A(ii,jj,kk)=M(r,4);
end
end
end
A is the 3d array
its giving error that
"Assignment has more non-singleton rhs dimensions than non-singleton subscripts"
Error in tensor A(ii,jj,kk)=M(r,4);