How do I modify this small code to be able to extract data to a matrix and not a buffer?
Afficher commentaires plus anciens
url_string='http://ichart.finance.yahoo.com/table.csv?s=AAPL&a=10&b=15&c=2005&d=01&e=17&f=2006&g=d&ignore=.csv'
buffer = java.io.BufferedReader(...
java.io.InputStreamReader(...
openStream(...
java.net.URL(url_string))));
% Begin with 2nd line (exclude header)
ptr = 1;
while 1
% Read line
buff_line = char(readLine(buffer));
% Break if this is the end
if length(buff_line)<3, break; end
% Find comma delimiter locations
commas = find(buff_line== ',');
% Extract high, low, open, close, etc. from string
adj_close = str2num( buff_line(commas(6)+1:end) )
ptr = ptr + 1;
end
%end
How do I change the code to
1.) Be able read in every line starting with the second line and transform this information into a matrix with only adj_close?
2.) This part should be easy: The format comes in a format where the most recent date is at the first line, most recent-1 is the next line and so on... How do I resort this matrix where adj_close is resorted? Basically the 1st value becomes the last and the last becomes the first (so on and so forth) Does flipud do this?
Thanks for all of your help,
-LG
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Text Files 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!