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 File to import variables from. Content of variable highlighted in list. List of variables to be imported. TheleftpaneofthedialogboxdisplaysalistofthevariablesMATLAB createdforyourdata.Fortextfiles,MATLAB derives the variable names as described in step 2: Preview Contents of the File. For binary files, the variable names are taken directly from the file. Click any variable name and MATLAB displays the contents of that variable in the pane to the right. MATLAB highlights the name of the variable that is currently displayed in the right pane. Structuring the Output Data The top portion of this dialog box offers three options for organizing the file’s data: • Create variables matching preview • Create vectors from each column using column names • Create vectors from each row using row names 6-14

Using the Import Wizard Note For data imported from a binary file, only the top option is active. Variable names and assignment are taken directly from the imported file. For text data, you can use any of the three options, however, the bottom two are active only if the file or clipboard contains row or column headers. While importing from the example text file grades.txt, select the third option to create vectors from row names. Observe that the display replaces the default variable assignments with new variables derived from the row headers. Click any of these variable names, and the Wizard displays the contents of the corresponding row vector. Select this option to create vectors from row header. List contains variables by row header. Selecting Which Variables to Write to the Workspace The checkboxes to the left of each variable name enable you to include or excludeindividualvariablesfromthosethatwillbewrittentotheworkspace. By default, all variables are selected. Select the checkbox of any variable you do not want written to the workspace. The check mark is removed from any variables that you deselect. 6-15

6 Data Import and Export<br />

File to import variables from.<br />

Content of variable highlighted in list.<br />

List of variables to be imported.<br />

Theleftpaneofthedialogboxdisplaysalistofthevariables<strong>MATLAB</strong><br />

createdforyourdata.Fortextfiles,<strong>MATLAB</strong> derives the variable names as<br />

described in step 2: Preview Contents of the File. For binary files, the variable<br />

names are taken directly from the file.<br />

Click any variable name and <strong>MATLAB</strong> displays the contents of that variable<br />

in the pane to the right. <strong>MATLAB</strong> highlights the name of the variable that is<br />

currently displayed in the right pane.<br />

Structuring the Output Data<br />

The top portion of this dialog box offers three options for organizing the file’s<br />

data:<br />

• Create variables matching preview<br />

• Create vectors from each column using column names<br />

• Create vectors from each row using row names<br />

6-14

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

Saved successfully!

Ooh no, something went wrong!