How to preserve row indices when converting an indexed matrix to a table?
I currently have an index matrix that I want to convert into a data table, and store the corresponding indices as fields in the data table. I tried using the table() function to achieve this, but when actually outputting, the index fields were ignored.
Here is my code:
m = matrix(1..5, 6..10);
m.rename!(2021.01.01..2021.01.05, `A`B);
m.setIndexedMatrix!();
table(m)
My expected result is:
| A | B | |
|---|---|---|
| 2021.01.01 | 1 | 6 |
| 2021.01.02 | 2 | 7 |
| 2021.01.03 | 3 | 8 |
| 2021.01.04 | 4 | 9 |
| 2021.01.05 | 5 | 10 |
But the actual result is:
| A | B |
|---|---|
| 1 | 6 |
| 2 | 7 |
| 3 | 8 |
| 4 | 9 |
| 5 | 10 |
How should I modify my code to achieve my expected result?