How can I format unknown filename with urlread?
1 view (last 30 days)
Show older comments
Hi all.
I must retrieve .txt file from a url like this:
but I don't succeed in using urlread, because the number between 'vadar_' and '_m0' is generating in real time (after a cgi query reported on web toolbar). How can I use a format mode for any unknown number in urlread?
Regards.
0 Comments
Accepted Answer
Walter Roberson
on 17 Apr 2013
If you are getting it from a query then you can probably get it as a string. Then you can form the URL name as
['http://vadar.wishartlab.com/tmp/vadar_' NUMBERSTRING '_m0.stats.txt']
4 Comments
Walter Roberson
on 17 Apr 2013
The HTML generated by the site includes
<A HREF=/tmp/vadar_1366211367_m0.stats.txt target=_blank>Statistics</A>
You can parse this out of the string "stat" using regexp
relurl = regexp( stat, '(?<=HREF=)(\S+)(?=\s\S+Statistics)', 'match');
url = [ 'http://vadar.wishartlab.com' relurl{1} ];
urlread(url)
More Answers (0)
See Also
Categories
Find more on Debugging 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!