Matlab Warning: Concatenation of empty arrays
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have write these lines in a matlab function
[r2, c2] = find(row == -2);
[r10, c10] = find(row == -10);
[r11, c11] = find(row == -11);
[r15, c15] = find(row == -15);
c = [c2 c10 c11 c15];
When I run the function on the matlab prompt I visualize this warning on the last line of the above code
Warning: Concatenation involves an empty array with an incorrect number of rows.
How can I resolve this warning?
Thanks in advance
Andrew
1 comentario
Walter Roberson
el 26 de En. de 2013
Please tell us what you get for
size(c2)
size(c10)
size(c11)
size(c15)
Respuestas (2)
Azzi Abdelmalek
el 26 de En. de 2013
Editada: Azzi Abdelmalek
el 26 de En. de 2013
Because c2 and c10, for example, have not the same size, then you can't concatenate them horizontally. Use instead
c = [c2 ;c10; c11; c15];
0 comentarios
Walter Roberson
el 26 de En. de 2013
Perhaps this would be suitable?
c = find(row == -2 | row == -10 | row == -11 | row = -15);
which could also be coded as
c = find(ismember(row, [-2, -10, -11, -15]));
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!