Is it possible to rename the indices of a matrix in octave? I need specific names for the rows and columns. Can I do that; if yes, how? I have to assemble matrices to get one large matrix. And it is not normal concatenation. There is a specific element-to-element transformation which requires particular naming of the rows and columns. How can I achieve this? Also, can I access these elements later on using these names?
Use the octave dataframe package which is based on R's data.frame
data type. This package first version was 0.8, and released in October 2010. At that time, Octave latest release was 3.2.4.
octave> pkg load dataframe
octave> x = dataframe (rand (7, 3), "colnames", {"foo", "bar", "baz"})
x = dataframe with 7 rows and 3 columns
_1 foo bar baz
Nr double double double
1 0.227254 0.17613 0.11311
2 0.626745 0.47250 0.74212
3 0.062161 0.49492 0.40909
4 0.636538 0.25582 0.92339
5 0.906660 0.70828 0.63547
6 0.521425 0.95103 0.81526
7 0.305666 0.28913 0.28903
octave> x.foo
ans =
0.227254
0.626745
0.062161
0.636538
0.906660
0.521425
0.305666
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.