Need help in downloading zip file from a url

조회 수: 13 (최근 30일)
PriyankaDanda
PriyankaDanda 2016년 6월 9일
댓글: PriyankaDanda 2016년 6월 9일
Hello, I am trying to download a zip file from an url that I am generating through code. Problem is when I use the url as a whole(without generating, one big string ) in websave command, I am able to get the zip file. But the same url when genrated (matrix of strings) I'm getting a html page instead. What do I do?
simple ungenerated url that downloads zip file:
url = ['http://www.bseindia.com/download/BhavCopy/Equity/EQ080616_CSV.ZIP']
filename = 'Equity8thjune';
websave(filename,url);
generated url that does not download zip file:
A=080616;
url= ['http://www.bseindia.com/download/BhavCopy/Equity/EQ' [num2str(A)] '_CSV.ZIP'];
filename = 'Equity8thjune';
websave(filename,url);

채택된 답변

Walter Roberson
Walter Roberson 2016년 6월 9일
num2str() does not generate leading zeros unless you tell it to. Use num2str(A,'%06d') instead of num2str(A)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Compression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by