フィルターのクリア

Error in for loop with function

1 回表示 (過去 30 日間)
Andrew Czeizler
Andrew Czeizler 2019 年 3 月 16 日
コメント済み: Andrew Czeizler 2019 年 3 月 16 日
Hi all,
I am getting a strange error on a what i think is a simple for loop.
The alphavantage function is located-
I want the loop, to loop over symbols and create a seperate table for each symbol.
My attempt is below. The function buy itself works as expected.
Best,
Andrew
>> symbols = {'^GSPC', 'DAX', '^N225', 'GLD', 'QQQ'};
for k = 1:length(symbols)
symbols{k} = table2timetable(F_Alphavantage('time_series_daily_adjusted', 'symbol',...
symbols{k}, 'outputsize', 'full'));
end
disp(head(data{1}))
Subscripting a table using linear indexing (one subscript) or multidimensional indexing (three or more
subscripts) is not supported. Use a row subscript and a variable subscript.
>>
  3 件のコメント
Rik
Rik 2019 年 3 月 16 日
The error seems to be in the disp, not in the rest of the code. Can you copy all the red text that is showing up?
Andrew Czeizler
Andrew Czeizler 2019 年 3 月 16 日
oh know! my bad! so the below works-
but i cant get the loop to create seperate named timetables. how to get the symbol names on the timetable?
Best.
Andrew
symbols = {'^GSPC', 'DAX', '^N225', 'GLD', 'QQQ'};
for i = 1:length(symbols)
data{i} = table2timetable(F_Alphavantage('time_series_daily_adjusted', 'symbol',...
symbols{i}, 'outputsize', 'full'));
end

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

回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by