Borrar filtros
Borrar filtros

Nested for loops - FOR expression comma separated list Error

1 visualización (últimos 30 días)
Del
Del el 24 de Mzo. de 2014
Respondida: Matt J el 24 de Mzo. de 2014
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.

Respuestas (1)

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

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by