Re: Importing Data



"us " <us@xxxxxxxxxxxxxxx> wrote in message <gk4ob9$mvc$1@xxxxxxxxxxxxxxxxxx>...
"Chad "
I'm relatively new to importing data from the internet. I'm trying to sim=
plify importing this dataset:http://data.giss.nasa.gov/gistemp/tabledata/GL=
B.Ts.txt

Sorry. Should have specified. I just need the 12 numerical values for each month in each row...

one of the solutions is outlined below

% the data
url='http://data.giss.nasa.gov/gistemp/tabledata/GLB.Ts.txt';
% the engine
fmt='%4d';
u=urlread(url);
s=strread(u,'%s','delimiter','','whitespace','');
ix=cellfun(@(x) ~isempty(sscanf(x(1:min([4,numel(x)])),fmt)),s);
s=regexprep(s(ix),'(*)+',' nan');
s=cellfun(@(x) sscanf(x,'%g').',s,'uni',false);
s=cat(1,s{:});
% the result (the last few entries only)
disp('some original data');
disp(u(13740:end));
disp('some extracted data');
disp(s(end-4:end,:));

us

Thank you very much us! Your code worked perfectly. I had found a solution, but mine crashed when it get's to 2008 cause December's data point isn't a number (I was using str2num). Thank you again.
.



Relevant Pages

  • Re: etesters
    ... engine. ... They listed a bunch of our products without our knowing about it. ... There should 30 entries per page or so, ...
    (sci.electronics.design)
  • Re: Take out index
    ... I know that I want to add 2 to each element, expect for the entries 1:2:end ... % Engine part ... IDX = strcmpi; ...
    (comp.soft-sys.matlab)
  • Explorer Question
    ... predictive text box entries on a web page. ... it annoying when typing entries into a web page or search ... engine and it prompts pre-written text entries. ... Regards ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Israel finally defends itself
    ... to accuse them of lying, we need to present evidence to _demonstrate_ ... engine & here's a link what I got: ... Almost 400 entries. ...
    (soc.culture.jewish.moderated)