You can call the “wget” command from MATLAB using the bang (!) operator:
The exclamation point character (!), sometimes called bang, is a shell escape. The character indicates that the rest of the input line is a command to the operating system. Use it to invoke utilities or call other executable programs without quitting MATLAB. To use the exclamation point in a factorial expression, call the factorial function. For example:
>> !wget --content-disposition "<url>"
This will execute the “wget” command as a system command from MATLAB.
Other possible workarounds for using "wget" are as follows:
1) Use the command “web”:
However, it will open a dialog box and will ask you to save. It will require user interaction.
For more information on the function “web”, you can access the release-specific documentation by running the following command in MATLAB R2020b:
>> web(fullfile(docroot, 'matlab/ref/web.html'))
2) Use the command “websave”:
Give a name to the file and specify the type in which you want to save the data.
>> filename = ' eng-hourly-12012012-12312012.csv';
Create a variable named url and assign the URL to the variable from which you want to download the data.
>> url = 'http://climate.weather.gc.ca/climate_data/bulk_data_e.html?format=csv&stationID=6358&Year=2012&Month=12&Day=14&timeframe=1&submit= Download+Data';
The “websave” function will save the data from the given URL to the specified file.
>> outputfilename = websave(filename,url);
For more information regarding the “websave” function, please follow the documentation link below:
Please follow the link below to search for the required information regarding the current release: