How to sequentially process the columns of a table?
2 views (last 30 days)
Show older comments
Dear Experts,
I have a table, tableA as shown below.
tableA
portfolio0 portfolio1 portfolio2 ... portfolio9 returns date
XX XX XX XX XX 199901
XX XX XX XX XX 199901
XX XX XX XX XX 199901
....
XX XX XX XX XX 199901
I can compute the total return for column 1 as
portfolio0 = tableB.portfolio0 .* tableB.returns.
However, when i do the following, I have an error. When I use
tableB.strcat('portfolio', 'i') = tableA.strcat('portfolio', 'i') .* tableA.returns where i = 0 to 9.
How do I process portfolio0 to portfolio9 together and store it like tableB as shown below.
tableB
portfolio0 portfolio1 ... portfolio2 date
XXX XXX XXX 199901.
In actual case, I will have tableA for different date and the processing are shown above. Hence the final tableB will look like
tableB
portfolio0 portfolio1 ... portfolio2 date
XXX XXX XXX 199901
XXX XXX XXX 199902
....
XXX XXX XXX 199912
Thank you so much for your advice LL
0 Comments
Answers (1)
See Also
Categories
Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!