Any ideas why I am getting this 'catch' error? Does anyone know how I can solve it?
Afficher commentaires plus anciens
%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
Réponse acceptée
Plus de réponses (1)
Malcolm Lidierth
le 13 Nov 2011
try
thisdata=urlread(thisurl);
catch
continue
end
....
Catégories
En savoir plus sur Cell Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!