how to combine matrices

4 visualizaciones (últimos 30 días)
Ani Asoyan
Ani Asoyan el 23 de En. de 2020
Comentada: Ani Asoyan el 23 de En. de 2020
I have two matrices: A & B ... I want to combine them so that every element will be near the other one's corresponding element. For example something like C matrix.
A=[1,2;3,4]
B=[5,6;7,8]
C=[15,26; 37, 48]
  3 comentarios
Walter Roberson
Walter Roberson el 23 de En. de 2020
Note that if you have negative entries then you will need to define what the results are expected to be.
Ani Asoyan
Ani Asoyan el 23 de En. de 2020
Mohammad Sami Thank you , these options are great, but they don't work when the second matrix has a negative element

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de En. de 2020
  6 comentarios
Walter Roberson
Walter Roberson el 23 de En. de 2020
That is not possible in MATLAB unless you are willing to use cell arrays C{1,2} = [-2 -6]
Ani Asoyan
Ani Asoyan el 23 de En. de 2020
okay ,sorry I didn't see your 'kron(A, [1 0]) + kron(B, [0 1])' answer , I think this is the most convenient one. Thank you !!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices 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