Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Create a new matrix with values that appear in two separate matrix

1 vue (au cours des 30 derniers jours)
Isaiah Stefan Engle
Isaiah Stefan Engle le 3 Avr 2017
Clôturé : MATLAB Answer Bot le 20 Août 2021
I am new to Matlab and thus this could be a very trivial question and I appreciate those who take the time to help. I have a 618x2 matrix that has values in the first column and then the index of the value (circles on an image for this case). For example
46.9810, 1
0, 2
0, 3
0, 4
43.1429, 5
0, 6
0, 7...
This matrix is called 'Test2'
I have another matrix that is a 1x58 matrix (called overlapindex) The values in this matrix corresponds to the index in the 'Test2' matrix for example: 1, 3, 5, 7, 35, 37, 44, 49,....
I need a new matrix (let's call it NEW) that checks if the value in overlapindex has a nonzero correlating value in the 'Test2' matrix. For example, this NEW matrix would include [43.1429, 5] because the index is in both 'Test2' and also in 'overlapindex' and the corresponding value in 'Test2' is nonzero.
so essentially this 'NEW' matrix would look like...
46.9810, 1
43.1429, 5
and so on until all the indexes are checked and the 'NEW' matrix is made.
I just need to make sure that the index in 'overlapindex' corresponds to an actual non zero value in the 'Test2' matrix.
Please help and thank you in advance!

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by