Learning how to import data from excel into MATLAB is an important skill. Some r
ID: 2990110 • Letter: L
Question
Learning how to import data from excel into MATLAB is an important skill. Some real-time data
acquisition tools use Excel. Getting data off the web is also important since a large number of
websites contain data that arise in the fields of engineering and finance for example. Data is
available for download and use by engineers to study how their systems would process real or
simulated data stored on these websites. In this exercise, you will be downloading discrete-time
data from the web into Excel, and then importing the data into MATLAB.
First go to the website http://finance.yahoo.com and enter the symbol MUTHX, click on
Explanation / Answer
Try out these steps:
Step 1
Locate the Excel data file, with file extension ".xls," on your computer. MATLAB cannot import data from the Excel executable directly and must know the location of the data file for import. If you are unable to locate the correct data file, contact your system administrator.
Step 2
Open the MATLAB executable.
Related Reading: How to Copy From the Internet and Paste Into Excel
Step 3
Launch the MATLAB Data Import Wizard by selecting "Import Data..." from the File menu or by entering the command "uiimport" into the MATLAB command prompt.
Step 4
Navigate the file system to select your Excel data file. Click "Open" on the dialog box to have MATLAB display a preview of data in the file.
Step 5
Select the desired worksheet from the Excel file for import using the radiobox input of the left side of the import wizard dialog box. Choose the columns and rows from the spreadsheet you wish to import by selecting them on the right side of the import wizard dialog box.
Step 6
Click "Next" on the dialog box to preview the imported MATLAB variables. Deselect any variables you do not wish to import, and rename them to your specifications. Click "Finish" to finish importing your Excel data.
Step 7
Use the "xlsread()" function to import Excel data in a work flow without requiring user input.
[num_data, text_data, raw_data] = xlsread(my_filename, sheet_num, data_range);
The "num_data" variable contains a numeric array with the numeric data from the spreadsheet. The "text_data" contains a cell array, MATLAB's multiple-data-type array, with the text data from the spreadsheet. The "raw_data" variable contains all data in a cell array.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.