Create an array containing indeces and value

Hi everyone,
I have a problem that I don't know how to solve. How Can I create an array C from two matrix A (50X100)and B (50X100) where the matrix B contains the x coordinates of the value contained in Matrix A (meaning that to the value in the first row A correspond the coordinates in the first row B)?
Thank you so much

5 commentaires

Matt J
Matt J le 21 Avr 2022
You haven't described the relationship that C should have to A and B.
Paola
Paola le 21 Avr 2022
yeah, I tought crating a cell array C with all of my scaled curves would be a good idea
Paola
Paola le 21 Avr 2022
Yeah I need to plot it but I also need to do other operations with the data. So I need to have them saved in the workspace.
Thanks
Matt J
Matt J le 21 Avr 2022
They already are saved in the workspace as A and B.
Paola
Paola le 21 Avr 2022
I need to the cross correlate the "combined" vectors with another vector. I don't know how to do it if they are separated.

Connectez-vous pour commenter.

Réponses (2)

Matt J
Matt J le 20 Avr 2022
Modifié(e) : Matt J le 20 Avr 2022
Would this be a simplified example fo what you mean?
[A,B]=ndgrid(1:5)
A = 5×5
1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5
B = 5×5
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
C=A.^2+B.^2
C = 5×5
2 5 10 17 26 5 8 13 20 29 10 13 18 25 34 17 20 25 32 41 26 29 34 41 50

1 commentaire

Paola
Paola le 21 Avr 2022
HI Matt,
thank you for your answer. What I am trying to do is scaling a curve. I have a matrix A in which each row contains the values of a curve and B is another matrix in which each row contains the x-value of the curves.
I want to combine the two.
Thanks

Connectez-vous pour commenter.

Matt J
Matt J le 21 Avr 2022

0 votes

I need to the cross correlate the "combined" vectors with another vector. I don't know how to do it if they are separated.
xcorr2() or imfilter() should do that directly.

Catégories

En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange

Question posée :

le 20 Avr 2022

Réponse apportée :

le 21 Avr 2022

Community Treasure Hunt

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

Start Hunting!

Translated by