Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
Isaiah Stefan Engle
Isaiah Stefan Engle 2017 年 4 月 3 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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!

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by