MATLAB Programming

MATLAB Programming MATLAB Programming

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

Converting Between Strings and Cell Arrays ........... 12-31 Search and Replace Using Regular Expressions ......... 12-31 Evaluating Expressions ............................ 12-33 Find Alternatives to Using eval ...................... 12-33 Assigning to a Series of Variables .................... 12-33 Short-Circuit Logical Operators ...................... 12-33 Changing the Counter Variable within a for Loop ....... 12-34 MATLAB Path ..................................... 12-35 Precedence Rules .................................. 12-35 File Precedence ................................... 12-36 Adding a Directory to the Search Path ................ 12-36 Handles to Functions Not on the Path ................. 12-36 Making Toolbox File Changes Visible to MATLAB ....... 12-37 Making Nontoolbox File Changes Visible to MATLAB .... 12-38 Change Notification on Windows ..................... 12-38 Program Control .................................. 12-39 Using break, continue, and return .................... 12-39 Using switch Versus if .............................. 12-40 MATLAB case Evaluates Strings ..................... 12-40 Multiple Conditions in a case Statement ............... 12-40 Implicit Break in switch-case ........................ 12-40 Variable Scope in a switch .......................... 12-41 Catching Errors with try-catch ...................... 12-41 Nested try-catch Blocks ............................ 12-42 Forcing an Early Return from a Function .............. 12-42 Save and Load ..................................... 12-43 Saving Data from the Workspace ..................... 12-43 Loading Data into the Workspace .................... 12-43 Viewing Variables in a MAT-File ..................... 12-44 Appending to a MAT-File ........................... 12-44 SaveandLoadonStartuporQuit .................... 12-45 Saving to an ASCII File ............................ 12-45 Files and Filenames ................................ 12-46 Naming M-files ................................... 12-46 Naming Other Files ............................... 12-46 Passing Filenames as Arguments .................... 12-47 Passing Filenames to ASCII Files .................... 12-47 xxii Contents

Determining Filenames at Run-Time ................. 12-47 Returning the Size of a File ......................... 12-47 Input/Output ...................................... 12-49 File I/O Function Overview ......................... 12-49 Common I/O Functions ............................. 12-49 Readable File Formats ............................. 12-50 Using the Import Wizard ........................... 12-50 Loading Mixed Format Data ........................ 12-50 Reading Files with Different Formats ................. 12-51 Reading ASCII Data into a Cell Array ................. 12-51 Interactive Input into Your Program .................. 12-51 Starting MATLAB .................................. 12-52 Getting MATLAB to Start Up Faster .................. 12-52 Operating System Compatibility .................... 12-53 Executing O/S Commands from MATLAB ............. 12-53 Searching Text with grep ........................... 12-53 Constructing Paths and Filenames ................... 12-53 Finding the MATLAB Root Directory ................. 12-54 Temporary Directories and Filenames ................. 12-54 Demos ............................................ 12-55 Demos Available with MATLAB ..................... 12-55 For More Information .............................. 12-56 Current CSSM .................................... 12-56 Archived CSSM ................................... 12-56 MATLAB Technical Support ......................... 12-56 Tech Notes ....................................... 12-56 MATLAB Central ................................. 12-56 MATLAB Newsletters (Digest, News & Notes) .......... 12-56 MATLAB Documentation ........................... 12-56 MATLAB Index of Examples ........................ 12-56 xxiii

Determining Filenames at Run-Time ................. 12-47<br />

Returning the Size of a File ......................... 12-47<br />

Input/Output ...................................... 12-49<br />

File I/O Function Overview ......................... 12-49<br />

Common I/O Functions ............................. 12-49<br />

Readable File Formats ............................. 12-50<br />

Using the Import Wizard ........................... 12-50<br />

Loading Mixed Format Data ........................ 12-50<br />

Reading Files with Different Formats ................. 12-51<br />

Reading ASCII Data into a Cell Array ................. 12-51<br />

Interactive Input into Your Program .................. 12-51<br />

Starting <strong>MATLAB</strong> .................................. 12-52<br />

Getting <strong>MATLAB</strong> to Start Up Faster .................. 12-52<br />

Operating System Compatibility .................... 12-53<br />

Executing O/S Commands from <strong>MATLAB</strong> ............. 12-53<br />

Searching Text with grep ........................... 12-53<br />

Constructing Paths and Filenames ................... 12-53<br />

Finding the <strong>MATLAB</strong> Root Directory ................. 12-54<br />

Temporary Directories and Filenames ................. 12-54<br />

Demos ............................................ 12-55<br />

Demos Available with <strong>MATLAB</strong> ..................... 12-55<br />

For More Information .............................. 12-56<br />

Current CSSM .................................... 12-56<br />

Archived CSSM ................................... 12-56<br />

<strong>MATLAB</strong> Technical Support ......................... 12-56<br />

Tech Notes ....................................... 12-56<br />

<strong>MATLAB</strong> Central ................................. 12-56<br />

<strong>MATLAB</strong> Newsletters (Digest, News & Notes) .......... 12-56<br />

<strong>MATLAB</strong> Documentation ........................... 12-56<br />

<strong>MATLAB</strong> Index of Examples ........................ 12-56<br />

xxiii

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

Saved successfully!

Ooh no, something went wrong!