Nested for loops - FOR expression comma separated list Error

1 view (last 30 days)
When I try to run this code:
A = zeros(30000, NV);
counter = 1;
for k = 1:P
for n = GN(:,k)
for i = AT{n}
A(counter, pMap(i,1,1)) = - w(i,k);
end
counter = counter + 1;
end
end
I am getting this error: "FOR expression comma separated list must have exactly one item".
I am not sure what is going on.
NV is some number like 7000.
GN is a matrix of the form
[1 2 3;
2 3 4;
3 4 5]
AT is a cell array where its entries are arrays of the form:
AT{1} = [1 2 3 4 5 6 7 8 9 10];
AT{2} = [11 12 13 14 15 16 17 18 19 20]; etc...
Any help would be appreciated.

Answers (1)

Matt J
Matt J on 24 Mar 2014
for n = GN(:,k).' %<-- note transpose

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!