# MATLAB: How to use ‘wget’ command in Linux

I'm trying to run a program that needs to access the 'wget' the command as follows:
[result, cmdout] = system('wget -h');
Do you have any suggestions to get it working in Linux?

You can call the “wget” command from MALTAB using 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>"
It will execute the “wget” command as system command from MATLAB.
Other possible workarounds for using "wget" are as follows:
1) Use the command “web”:
>> web('<url>');
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”, follow the below documentation page:
2) Use the command “websave”:
Give a name of the file and type in which you want to save the data.
>> filename = ' eng-hourly-12012012-12312012.csv';
Create a variable name 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';
“websave” function will save the data from the given url to the given file.
>> outputfilename = websave(filename,url);