A general question of matrix to matrix

1 visualización (últimos 30 días)
Martin
Martin el 12 de Ag. de 2015
Comentada: Martin el 12 de Ag. de 2015
Hello buddies,
I have 2 matrices:
a = [ 1 2 3; 4 5 6 ]
b = [ 9 9 9; 9 9 9 ]
I'm wondering if there is a function, or an CPU non-burdensome way to get the following result:
c = [ 1 9 2 9 3 9 ; 4 9 5 9 6 9 ]
Right now I do it with for loop, but it take ALOT of time!
Any help will be very appreciated, thanks.
Have a good day,
-best

Respuesta aceptada

Adam
Adam el 12 de Ag. de 2015
Editada: Adam el 12 de Ag. de 2015
reshape( [a; b], [2 6] )
with obvious generalisations for different sizes of vector and assumptions on a and b having the same dimensions
  1 comentario
Martin
Martin el 12 de Ag. de 2015
thanks :) now I can delete 90% of my script

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by