How to assign elements in a matrix in another matrix with order not in sequence?

3 visualizaciones (últimos 30 días)
I am trying to substitute the elements in matrix K to element K1 such that the matrix K has 10th, 11th,12th,7th, 8th and 9th elements in rows and column. How to assign this matrix in matrix K1 in it's own order???

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 20 de Jul. de 2018
Not sure how you want to assign between K and K1, but here is an example, just specify the row and column number
>> A=magic(5)
A =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
>> B=A([4,3,2],[2,5,3])
B =
12 3 19
6 22 13
5 16 7
  2 comentarios
Stephen23
Stephen23 el 20 de Jul. de 2018
Achyut Paudel's "Answer" moved here:
Thanks for your answer, but this is not what I mean. I am actually working to substitute the elements of matrix K in matrix K1 such that the (7,7) element on matrix K1 is V as shown in figure. Similarly, element on Matrix K1 (9,10) is IJ.
If you got what I mean, please help me.
Fangjun Jiang
Fangjun Jiang el 21 de Jul. de 2018
okay, follow my above example
A([4,3,2],[2,5,3])=B+100
So I think what you need is
K1([10 11 12 7 8 0],[10 11 12 7 8 9])=K

Iniciar sesión para comentar.

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!

Translated by