MATLAB Programming

MATLAB Programming MATLAB Programming

cda.psych.uiuc.edu
from cda.psych.uiuc.edu More from this publisher
23.06.2015 Views

6 Data Import and Export Terminating SEND function. % ANSWER reads the second message. Received message from SEND: I received your reply. 6-74

Importing Text Data Importing Text Data The section describes various ways to import text data into MATLAB. It covers these topics: • “The MATLAB Import Wizard” on page 6-75 • “Using Import Functions with Text Data” on page 6-75 • “Importing Numeric Text Data” on page 6-78 • “Importing Delimited ASCII Data Files” on page 6-79 • “Importing Numeric Data with Text Headers” on page 6-80 • “Importing Mixed Alphabetic and Numeric Data” on page 6-81 • “Importing from XML Documents” on page 6-83 Caution When you import data into the MATLAB workspace, you overwrite any existing variable in the workspace with the same name. The MATLAB Import Wizard TheeasiestwaytoimportdataintoMATLABistousetheImportWizard. You do not need to know the format of the data to use this tool. You simply specify the file that contains the data and the Import Wizard processes the file contents automatically. For more information, see “Using the Import Wizard” on page 6-9. Using Import Functions with Text Data To import text data from the command line or in an M-file, you must use one of the MATLAB import functions. Your choice of function depends on how the data in the text file is formatted. The text data must be formatted in a uniform pattern of rows and columns, using a text character, called a delimiter or column separator, to separate each data item. The delimiter can be a space, comma, semicolon, tab, or any other 6-75

6 Data Import and Export<br />

Terminating SEND function.<br />

% ANSWER reads the second message.<br />

Received message from SEND:<br />

I received your reply.<br />

6-74

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!