I want to use MATLAB to read the data from a URL which is dynamically changing. Can I do this? Here is my code:
function reading(company, signal)
url1='https://finance.yahoo.com';
url2='market-overview';
url=strcat(url1,'company',url2,'signal');
name=strcat(company,signal);
urlwrite('url','name.h5');
I got this error:
Either this URL could not be parsed or the protocol is not supported.
Can anyone help me ?
url
, is a variable. 'url'
, is a string containing the letters url
. You seem to be treating them as if they are interchangeable.
i.e.. when you do this:
url1='https://finance.yahoo.com';
url2='market-overview';
url=strcat(url1,'company',url2,'signal');
The output will always be the same regardless of the variables company
and signal
, because you are only passing strings, not variable names. You need:
% company and signal are names of variables you pass into your function
url=strcat(url1,company,url2,signal);
(You ought to be able to work out, then, what the issue is with your urlwrite
command).