12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

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.

File Opening <strong>and</strong> Closing: fclose fopenUnformatted I/O: fread fwriteFormatted I/O: fgetl fprintffgets fscanfFile Positioning: fe<strong>of</strong> fseekferror ftellfrewindString Conversion: sprintf sscanf10 DirectoriesWhen you type a string <strong>of</strong> characters, say asdf at the matlab prompt<strong>and</strong> press return, matlab goes through the following sequence to try tomake sense <strong>of</strong> what you typed:1. Look for a variable called asdf;2. Look for a built in matlab function called asdf;3. Look in the current directory for an m-file called asdf.m;4. Look in the directories specified by the matlab search path for anm-file called asdf.m.The following comm<strong>and</strong>s are useful for working with different directoriesin matlab:cdpwddirwhatwhichtypepathaddpathrmpathChange to another directoryDisplay (print) current working directoryDisplay contents <strong>of</strong> current working directoryDisplay matlab-relevant filesin current working directoryDisplay directory containing specified functionDisplay file in the matlab windowDisplay or change the search pathAdd directory to the search pathRemove directory from the search pathIf the directory name contains a blank space, enclose it in single quotes:dir ’my documents’(On PCs or Macintoshes you can use the Path Browser GUI to manipulatethe path. Select ’File’→’Set Path’ or click the Path Browser buttonon the tool bar.)c○ 2000 by CRC Press LLC

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

Saved successfully!

Ooh no, something went wrong!