Cell components perpendicular division

1 visualización (últimos 30 días)
MarshallSc
MarshallSc el 17 de Jul. de 2021
Editada: DGM el 17 de Jul. de 2021
If I have a 4*4 cell array that each contain a 10*10 matrix as below (for example, Aii=10*10 matrix):
A={Aii Aij Aik Ail;
Aji Ajj Ajk Ajl;
Aki Akj Akk Akl;
Ali Alj Alk All};
How can I get a similiar cell array that denotes the division of perpendicular components such that I would get:
C={[Aii/Ajj] [Aij/Ajk] [Aik/Ajl] [Ail/Aji];
[Aji/Akj] [Ajj/Akk] [Ajk/Akl] [Ajl/Aki];
[Aki/Alj] [Akj/Alk] [Akk/All] [Akl/Ali];
[Ali/ij] [Alj/Aik] [Alk/Ail] [All/Aii]};

Respuesta aceptada

DGM
DGM el 17 de Jul. de 2021
Something like:
A = num2cell(reshape(1:16,[4 4])) % example array
B = cellfun(@rdivide,A,circshift(A,[-1 -1])) % output
To describe the shifting, consider the example:
A = {'Aii' 'Aij' 'Aik' 'Ail';
'Aji' 'Ajj' 'Ajk' 'Ajl';
'Aki' 'Akj' 'Akk' 'Akl';
'Ali' 'Alj' 'Alk' 'All'};
circshift(A,[-1 -1])
ans = 4×4 cell array
{'Ajj'} {'Ajk'} {'Ajl'} {'Aji'} {'Akj'} {'Akk'} {'Akl'} {'Aki'} {'Alj'} {'Alk'} {'All'} {'Ali'} {'Aij'} {'Aik'} {'Ail'} {'Aii'}
  6 comentarios
MarshallSc
MarshallSc el 17 de Jul. de 2021
Thanks a lot for your great explanation!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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