I have a table from which I extract the largest element in each column defendant and his place in the table.
Max = max(ARRAY,[],1);
for i=1:1
for j=1:30
[X,Y] = find(ARRAY == Max(i,j));
Locations(i,j)=X;
end
end
I want to get a table Sample_Targets (i, j) 10 * 30 where depending on the value of (Locations (i, j)) from (1-10) to store in each column is a variable of type A = [1;0;0;0;0; 0;0;0;0;0];
for i=1:1
for j=1:30
switch Locations(i,j)
case {1}
Sample_Targets(i,j) = [1;0;0;0;0;0;0;0;0;0];
case {2}
Sample_Targets(i,j) = [0;1;0;0;0;0;0;0;0;0];
case {3}
Sample_Targets(i,j) = [0;0;1;0;0;0;0;0;0;0];
case {4}
Sample_Targets(i,j) = [0;0;0;1;0;0;0;0;0;0];
case {5}
Sample_Targets(i,j) = [0;0;0;0;1;0;0;0;0;0];
case {6}
Sample_Targets(i,j) = [0;0;0;0;0;1;0;0;0;0];
case {7}
Sample_Targets(i,j) = [0;0;0;0;0;0;1;0;0;0];
case {8}
Sample_Targets(i,j) = [0;0;0;0;0;0;0;1;0;0];
case {9}
Sample_Targets(i,j) = [0;0;0;0;0;0;0;0;1;0];
case {10}
Sample_Targets(i,j) = [0;0;0;0;0;0;0;0;0;1];
end
end
end
Every time I get the same error:
Subscripted assignment dimension mismatch.
What can I do?