read a formated text
Show older comments
How can I read the Information from the following text file?
<content d="2000-11-02" o="21.410" h="21.800" c="21.600" l="21.310" v="21014" bl="" />
<content d="2000-11-03" o="21.610" h="21.680" c="21.420" l="21.380" v="7412" bl="" />
<content d="2000-11-06" o="21.420" h="21.450" c="21.370" l="21.330" v="8795" bl="" />
<content d="2000-11-07" o="21.380" h="21.500" c="21.360" l="21.280" v="9994" bl="" />
What interests me are
"2000-11-06", 21.420, 21.450, 21.370, 21.330, 8795
I tried
textscan(fid, '\t<content d="%4d-%2d-%2d" o="%f" h="%f" c="%f" l="%f" v="%f" bl="" />')
or
textscan(fid, '\t<content d="%q" o="%f" h="%f" c="%f" l="%f" v="%f" bl="" />')
But it doesn't work. Anyone can help?
BTW, converting dates using
dates = cellfun(@(x)datenum(x, 'yyyy-mm-dd'), dates);
is kind of slow. Anyone knows a faster way?
Accepted Answer
More Answers (2)
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!