Reading urls only from a text file
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a text file having multiple urls with other information of the url.I want to download images from all the urls. How can I read the txt file and save the URLS only in an array to download it? I want to use C=textscan(fileId,formatspec) What should I mention in formatspec for URL as format? My text file has the content shown as below:
ID: 262
Name: VD0289 CUT OUT BACK DRESS
Image: http://dwimages.com/images/product/1/VD0289_VD0289_(4).jpg
Detailed Image: http://dwimages.com/images/detailed/0/VD0289_VD0289_(4).jpg
Image: http://dwimages.com/images/product/1/
Detailed Image: http://dwimages.com/images/detailed/1/VD0289_VD0289_(4).jpg
Detailed Image: http://dwimages.com/images/detailed/0/VD0289_VD0289.jpg
2 comentarios
Matt Kindig
el 1 de Jul. de 2013
I would use regular expressions instead of textscan(). Something like this should do it:
str= fileread('/path/to/your/file.txt'); %read in text file to memory
urls = regexp(str, 'http(\S+)(\s*)$', 'match', 'lineAnchors'); %find urls
Respuestas (0)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!