Borrar filtros
Borrar filtros

Correlation between a 3D matrix and a vector

4 visualizaciones (últimos 30 días)
Chiara Bulgarelli
Chiara Bulgarelli el 4 de Ag. de 2017
Comentada: Brian DeCicco el 1 de Jul. de 2021
Hello everyone, I have a 3D matrix (44x44x21 - channelsxchannelsxsubjects) and a vector of 21 elements (questionnaire answers for each subject). I would like to correlate the vector with all the cells of my 3D matrix. Of course I would like that answer for subject 1 (element 1 in the vector) is correlated with 44x44x1, answer for subj 2 with 44x44x2, etc... Is someone able to help me? Many thanks in advance
Chiara
  1 comentario
Jan
Jan el 8 de Ag. de 2017
Some standard terms: "matrix" is a 2D array. Cells are cell arrays, which can contain non elementary data as elements. Therefore "3D matrices" do not contain "all cells".
What does "element 1 in the vector is correlated with 44x44x1" exactly mean?

Iniciar sesión para comentar.

Respuesta aceptada

Chris Perkins
Chris Perkins el 8 de Ag. de 2017
Hi Chiara,
If I understand your goal correctly, you will likely need to both re-arrange your data and expand the vector data into a 3D matrix.
To re-arrange your initial 3D matrix data, you can use the "permute" function, as shown below:
matrix = permute(matrix,[3 1 2]);
This allows you to change your 44x44x21 matrix to a 21x44x44 matrix, so the dimensions agree with the vector.
The documentation for the "permute" function is found at the following link: https://www.mathworks.com/help/matlab/ref/permute.html
Then, expand the vector to be a 21x44x44 matrix, where each element is expanded to be a 44x44 matrix of the same, repeated element.
Once the dimensions agree, you can follow the procedure to manually compute the standard Pearson coefficient, as described in the following MATLAB Answers question: https://www.mathworks.com/matlabcentral/answers/15884-correlation-for-multi-dimensional-arrays
  1 comentario
Brian DeCicco
Brian DeCicco el 1 de Jul. de 2021
Hey Chris! I am trying to figure out a similar problem to this one, but am unsure how to "expand my vector to be a 3-D matrix, where each element is expanded to be a 1440x721 matrix of the same, repeated element". Can you assist? Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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