23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6 Data Import and Export<br />

• rowheaders—Column vector containing the names of all row headers.<br />

• colheaders—Row vector containing the names of all column headers.<br />

• textdata—Matrix containing all imported text data. Empty elements<br />

are set to ''.<br />

• data—Matrix containing all imported numeric data. Empty elements are<br />

set to NaN.<br />

If the imported file or clipboard contains only numeric or only text data, then<br />

the Import Wizard does not use the variable names shown above. Instead, it<br />

assignsallofthedatatojustonevariable:<br />

• For data imported from a text file, the name of the variable is the same as<br />

thefilename,minusthefileextension.<br />

• For data imported from the clipboard, the name of the variable is<br />

A_pastespecial.<br />

Specifying Delimiters and Header Format [Text only]<br />

Using the options shown at the top of the Import Wizard dialog box, you can<br />

specify a delimiter character for separating data items, and also the number<br />

of lines you want to use for column headers.<br />

Delimiters<br />

Most text files use a unique character called a delimiter or column separator<br />

to mark the separation between items of data. For example, data in a<br />

comma-separated value (CSV) file is, of course, separated by commas. Data in<br />

some other file might be separated by tab or space characters.<br />

When the Import Wizard imports from a text file or the clipboard, it makes its<br />

best guess as to which character was intended as the delimiter and displays<br />

the data accordingly. If this is not correct, you will need to set the correct<br />

delimiter from the choices shown under Select Column Separator(s)<br />

in the upper left of the dialog box. When you do this, the Import Wizard<br />

immediately reformats the data, displaying new values for the data shown<br />

in the preview pane.<br />

6-12

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

Saved successfully!

Ooh no, something went wrong!