maintain string in a cov matrix

1 回表示 (過去 30 日間)
fede
fede 2015 年 9 月 22 日
コメント済み: Matt J 2015 年 11 月 5 日
Hi I want to know if it's possible maintain the name of my stocks in the var-cov matrix. If I have a matrix as dataset, for example:
IBM JPM C
p11 p12 p13
p21 p22 p23
...........
pn1 pn2 pn3
it's not possible calculate the var-cov matrix untill I transform my dataset in matrix, but lossing my string (ibm ecc ecc).

採用された回答

Kirby Fears
Kirby Fears 2015 年 9 月 22 日
編集済み: Kirby Fears 2015 年 9 月 22 日
fede,
Your data can be stored in a table. Tables allow you to operate on numeric values while also keeping column headers to easily interpret your data.
If you are getting data from a delimited text file or Excel file, try using the readtable function so your data is in table format. If this is not an option, you can transform data from your workspace into a table.
Below is example code for building a table out of workspace data (a numeric matrix and cell of headers).
testdata = magic(3);
stocks = {'ibm','jpm','etc'};
tabledata = array2table(testdata,'VariableNames',stocks);
Hope this helps.
  1 件のコメント
Matt J
Matt J 2015 年 11 月 5 日
Accepted.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by