필터 지우기
필터 지우기

Reading urls only from a text file

조회 수: 2 (최근 30일)
ab
ab 2013년 7월 1일
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
Matt Kindig
Matt Kindig 2013년 7월 1일
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
ab
ab 2013년 7월 1일
편집: ab 2013년 7월 1일
Thanks it worked :).How can I assign the Name:VD0289 CUT OUT BACK DRESS to all the images under it in a lookup table.I have a lot of datas in this same format in the same txt file.Eg
I have this datas how can I make a lookup table to assign each url with its name and tags.that is the first 5 image should have the same name and tags assigned.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by