DOC PREVIEW
GT AE 6382 - MATLAB® 7 Programming Tips

This preview shows page 1-2-3-4-31-32-33-34-35-63-64-65-66 out of 66 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 66 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

tocProgramming TipsIntroductionCommand and Function SyntaxSyntax HelpCommand and Function SyntaxesCommand Line ContinuationCompleting Commands Using the Tab KeyRecalling CommandsClearing CommandsSuppressing Output to the ScreenHelpUsing the Help BrowserHelp on Functions from the Help BrowserHelp on Functions from the Command WindowTopical HelpPaged OutputWriting Your Own HelpHelp for Subfunctions and Private FunctionsHelp for Methods and Overloaded FunctionsDevelopment EnvironmentWorkspace BrowserUsing the Find and Replace UtilityCommenting Out a Block of CodeCreating M-Files from Command HistoryEditing M-Files in EMACSM-File FunctionsM-File StructureUsing Lowercase for Function NamesGetting a Function's Name and PathWhat M-Files Does a Function Use?Dependent Functions, Built-Ins, ClassesFunction ArgumentsGetting the Input and Output ArgumentsVariable Numbers of ArgumentsString or Numeric ArgumentsPassing Arguments in a StructurePassing Arguments in a Cell ArrayProgram DevelopmentPlanning the ProgramUsing Pseudo-CodeSelecting the Right Data StructuresGeneral Coding PracticesNaming a Function UniquelyThe Importance of CommentsCoding in StepsMaking Modifications in StepsFunctions with One Calling FunctionTesting the Final ProgramDebuggingThe MATLAB Debug FunctionsMore Debug FunctionsThe MATLAB Graphical DebuggerA Quick Way to Examine VariablesSetting Breakpoints from the Command LineFinding Line Numbers to Set BreakpointsStopping Execution on an Error or WarningLocating an Error from the Error MessageUsing Warnings to Help DebugMaking Code Execution VisibleDebugging ScriptsVariablesRules for Variable NamesMaking Sure Variable Names Are ValidDo Not Use Function Names for VariablesChecking for Reserved KeywordsAvoid Using i and j for VariablesAvoid Overwriting Variables in ScriptsPersistent VariablesProtecting Persistent VariablesGlobal VariablesStringsCreating Strings with ConcatenationComparing Methods of ConcatenationStore Arrays of Strings in a Cell ArrayConverting Between Strings and Cell ArraysSearch and Replace Using Regular ExpressionsEvaluating ExpressionsFind Alternatives to Using evalAssigning to a Series of VariablesShort-Circuit Logical OperatorsChanging the Counter Variable within a for LoopMATLAB PathPrecedence RulesFile PrecedenceAdding a Directory to the Search PathHandles to Functions Not on the PathMaking Toolbox File Changes Visible to MATLABMaking Nontoolbox File Changes Visible to MATLABChange Notification on WindowsProgram ControlUsing break, continue, and returnUsing switch Versus ifMATLAB case Evaluates StringsMultiple Conditions in a case StatementImplicit Break in switch-caseVariable Scope in a switchCatching Errors with try-catchNested try-catch BlocksForcing an Early Return from a FunctionSave and LoadSaving Data from the WorkspaceLoading Data into the WorkspaceViewing Variables in a MAT-FileAppending to a MAT-FileSave and Load on Startup or QuitSaving to an ASCII FileFiles and FilenamesNaming M-filesNaming Other FilesPassing Filenames as ArgumentsPassing Filenames to ASCII FilesDetermining Filenames at Run-TimeReturning the Size of a FileInput/OutputFile I/O Function OverviewCommon I/O FunctionsReadable File FormatsUsing the Import WizardLoading Mixed Format DataReading Files with Different FormatsReading ASCII Data into a Cell ArrayInteractive Input into Your ProgramStarting MATLABGetting MATLAB to Start Up FasterOperating System CompatibilityExecuting O/S Commands from MATLABSearching Text with grepConstructing Paths and FilenamesFinding the MATLAB Root DirectoryTemporary Directories and FilenamesDemosDemos Available with MATLABFor More InformationCurrent CSSMArchived CSSMMATLAB Technical SupportTech NotesMATLAB CentralMATLAB Newsletters (Digest, News & Notes)MATLAB DocumentationMATLAB Index of ExamplesMATLAB®7Programming TipsHow to Contact The MathWorkswww.mathworks.comWebcomp.soft-sys.matlab Newsgroupwww.mathworks.com/contact_TS.html Technical [email protected] Product enhancement [email protected] [email protected] Documentation error [email protected] Order status, license renewals, [email protected], pricing, and general information508-647-7000 (Phone)508-647-7001 (Fax)The MathWorks, Inc.3 Apple Hill DriveNatick, MA 01760-2098For contact information about worldwide offices, see the MathWorks Web site.MATLAB Programming Tips© COPY RIG HT 1984–2007 by The M ath Works, Inc.The software described in this document is furnished under a license agreement. The software may be usedor copied only under the terms of the license agreement. No part of this manua l may be photocopied orreproduced in any form without prior written consent from The MathWorks, Inc.FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentationby, for, or through the federal government of the United States. By accepting delivery of the Program orDocumentation, the government hereby agrees that this software or documentation qualifies as commercialcomputer software or commercial computer software documentation as such terms are used or definedin FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions ofthis Agreement and only those rights specified in this Agreement, shall pertain to and gove rn the use,modification, reproduction, release, performance, display, and disclosure of the Program and Documentationby the federal government (or other entity acquiring for or through the feder al government) and sha llsupersede any conflicting con tractual terms or conditions. If this License fails to meet the government’sneeds or is inconsistent in any respect with federal procurement law, the government agrees to return theProgram and Documentation, unused, to The MathWorks, Inc.TrademarksMATLAB, Simulink, Stateflow, Handle Graphics, R eal-Time Workshop, SimBiology,SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and TheMathWorks, the L-shaped membrane logo, Embedded MATLAB, and PolySpace aretrademarks of The MathWorks, Inc.Other product or brand names are trademarks or registered trademarks of their respectiveholders.PatentsThe MathWorks products are protected by one or more U.S. patents. Please seewww.mathworks.com/patents for more information.Revision HistoryJuly 2002 Online only New for MATLAB 6.5 (Release 13)June 2004 Online only Revised for MATLAB 7.0 (Release 14)March 2005 Online only Minor revision for MATLAB 7.0.4 (Release


View Full Document

GT AE 6382 - MATLAB® 7 Programming Tips

Download MATLAB® 7 Programming Tips
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view MATLAB® 7 Programming Tips and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view MATLAB® 7 Programming Tips 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?