I need MATLAB to read my data from the bottom up.

조회 수: 1 (최근 30일)
Shakib Ishfaq
Shakib Ishfaq 2019년 5월 27일
답변: Raghunandan V 2019년 5월 28일
I'm calculating portfolio returns from daily prices. As you can see from the attached file, my dates are organised such that latest date and price are listed first and then scrolling down the column, dates become older. So to calculate returns, I need MATLAB to read my data in inverse, from the bottom up.
I am calculating returns using the functions found on this page https://uk.mathworks.com/help/finance/tick2ret.html#tick2retexample3
however, this only allows me to return results for a single asset in my portfolio. I require returns for multiple product prices in my portfolio.
Any help deeply appreciated. Thank you.

답변 (1개)

Raghunandan V
Raghunandan V 2019년 5월 28일
Hi,
I can help you with first part of the question. To read it inverse
[NUM,TXT,RAW]=xlsread('Bonds.xlsx')
%get the length
[m n] = size(TXT)
for k=1: m
%to read from last
q = m-k+1
read = RAW(q)
end
I don't know about price series data. I think you have post another question for the second part with different tags to get the answer.

카테고리

Help CenterFile Exchange에서 Financial Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by