Error using horzcat Dimensions of matrices being concatenated are not consistent.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Yulia M
el 7 de Nov. de 2019
Comentada: Yulia M
el 7 de Nov. de 2019
Hi ,
I need help with this problem I am new to MATLAB please help me!
I am trying to do this operation.
V = [ g1 g2 V ];
where g1 is 256*1 complex double
g2 is 18*1 complex double
V is 256*39 complex double.
I am getting the above mentioned error.
Regards,
0 comentarios
Respuesta aceptada
Thorsten
el 7 de Nov. de 2019
You can only concatenate vectors horizontally if they have the same number of rows. But here you have 256 and 18 rows. sp this does not work. You can add zeros to g2 to blow it up to a 256 x 1 vector using
g2(256) = 0;
before you use
V = [ g1 g2 V ];
Another option would be to use cell arrays. The elements can have different sizes:
V = {g1, g2, V};
Más respuestas (0)
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!