Assigning time series in a structure

11 ビュー (過去 30 日間)
Temirlan Izmailov
Temirlan Izmailov 2018 年 9 月 28 日
回答済み: Peter Perkins 2018 年 10 月 1 日
Hi, I faced a problem with analyzing my data of stock price. All of the stocks and their prices were sorted by time. So I created a structure based on the number of unique tickers the stocks had. Thus, dividing the data into 300-ish parts. However, now I have a problem with time series analysis. The time in the structure is not considered a time vector. I would really appreciate if someone could explain why is that and how can I change that. Or maybe other way of analyzing it. Any example of analyzing the stocks prices would be helpful as well. Thank you very much.
  2 件のコメント
ANKUR KUMAR
ANKUR KUMAR 2018 年 9 月 28 日
Please attach the mat files.
Temirlan Izmailov
Temirlan Izmailov 2018 年 9 月 28 日
% Uploading and making the table basicly
[num,txt,raw]=xlsread('Deals.xlsx');
Price=num(:,17);
t=num(:,1);
issuer=txt(:,6);
issuer([1],:)=[];
date=datetime(t,'ConvertFrom','excel');
T1=table(date,issuer,Price);
% The only way i know to create 3 dimensional matrix is through Table cell
[~,~,i] = unique(T1(:,2));
for k=1:max(i)
TableCell{k}=T1(i==k,:);
end
% here I go for the structure, the only way i know to create multiple variables
u=unique(issuer);
for ind = 1:length(u)
s.(u{ind}=TableCell{:,ind,:};
end
%now if i try to assign the time series to the dates in the structure i fail
ts=timeseries(s.AKRL(:,3),s.AKRL(:,1);
Also If any of the steps could ease the process I would be very thankful. I am very new to Matlab.

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

回答 (1 件)

Peter Perkins
Peter Perkins 2018 年 10 月 1 日
Temirlan, I would think you'd want to read the spreadsheet using readtable, then convert that table to a timetable with one variable for each ticker. You have a lot of hard-to-follow code, and no example of what you are starting with and what you want to end up with.

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by