Any ideas why I am getting this 'catch' error? Does anyone know how I can solve it?

18 ビュー (過去 30 日間)
%Code to Get Matrix
fid=fopen('C:\Users\Laurentiu Galan\Desktop\Tickers.csv');
C = textscan(fid, '%s');
fclose(fid);
%Grab First Value (Just as check)
thisval=(C{1});
% Calculate Number of Tickers
D=size(thisval);
NumTick=D(1,1);
%Calculate Loop to download tickers
for i=1:NumTick
thissym=thisval{i};
thisurl = strcat('http://ichart.finance.yahoo.com/table.csv?s=', thissym, '&d=10&e=8&f=2011&g=d&a=0&b=1&c=2000&ignore=.csv');
thisdata=urlread(thisurl);
catch continue;
end
thisfilename = strcat(thissym, '.csv');
outputfile = strcat('C:\Users\Laurentiu Galan\Desktop\tickoutput\',thisfilename);
thisfileid=fopen(outputfile, 'wt')
fprintf(thisfileid, '%s\n',thisdata)
fclose(thisfileid)
end
I am getting an error right after the catch, saying illegal use of the word. Any ideas how I can solve this? I know the rest of the code works. Basically, I am trying to get the code to download the tickers from yahoo finance and to skip the ticker if there is a url read error.
Thanks

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 11 月 13 日
put "continue" in a separate line after "catch".
help catch

その他の回答 (1 件)

Malcolm Lidierth
Malcolm Lidierth 2011 年 11 月 13 日
try
thisdata=urlread(thisurl);
catch
continue
end
....

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by