提取具有特定值的矩阵元素的行和列名称?
我有两个与347只股票清单有关的矩阵. remainingTickers
矩阵为347 * 1,其中包含股票代号名称. GMAT
矩阵为347 * 347,其中包含0
或1
条目,这些条目指示一对股票的相关性是否大于0.5.
I have two matrices relating to a list of 347 stocks. The remainingTickers
matrix is 347*1 and contains stock symbol names. The GMAT
matrix is 347*347 and contains 0
or 1
entries that indicate whether a pair of stocks have a correlation greater than 0.5.
我想用两列创建一个新矩阵,该列由与GMAT
中每个1
值对应的行和列的股票符号名称对组成.我该怎么办?
I want to create a new matrix with two columns that consist of the pair of stock symbol names corresponding to the row and column for each 1
value in GMAT
. How can I do this?
我认为您可能需要以下内容:
I think you might need something like:
[i, j] = find(GMAT);
left = [remainingTickers(i)];
right = [remainingTickers(j)];
left{k}
和right{k}
将形成一对与k
的任何值相关的对.
left{k}
and right{k}
will form a pair that is correlated for any value of k
.