Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=140400001

MatLab Getting Started

MatLab: Getting Started

Major Reference Source: MatLab Verson 7.0

One way to start with MatLab is to use MatLab as a calculator. Commands are typed in the Command Window after the MatLab prompt, >>. Commands are then evaluated after pressing the Enter key.

MatLab as a Scratch Pad

Since MatLab provides an immediate computing capability for immediate evaluation, the Command Window can be used as a powerful multiple display scientific graphing calculator by entering MatLab commands at the prompt command, >>, using the PC keyboard.  Entered command will be displayed in the Command Window while evaluation results can be displayed in the Command Window or can be made use of the Figure Window to visualize the evaluation results graphically.

Common Useful Commands

 As entering interactive commands in the Command Window is one of the important feature of MatLab, some common useful commands should be known beforehand to using MatLab interactively.

Help Documentation

One important type of commands can be entered in the Command Window is calling functions by entering keywords at the Command Window. MatLab provides a MatLab help documentation set which can be accessed through the Help Browser by clicking on the help browser icon or by typing command in the Command Window.  Helps on standard MatLab keywords or topics can also be found in the help documentation set. Command examples:

  • doc: to open and display the first page of the online documentation in the Help Browser.

  • helpdesk: to open and display the first page of the online documentation in the Help Browser.

  • helpwin:  to open and display the "List of Help Topics" page of the online documentation in the Help Browser.

  • helpwin TOPIC:  to open and display the help page for the named TOPIC in the Help Browser.

  • helpbrowser: to bring up the Help Browser

  • help: to open and display the "List of Help Topics"  page of the online documentation in the Command Window.

  • help TOPIC: to open and display the help page for the named TOPIC in the Command Window.

  • lookfor STRING: to lookfor or search the first comment line of topic help pages for the keyword STRING and display the matched comment lines in the Command Window.

Workspace Manipulation

Another important type of commands can be entered in the Command Window is creating variables by typing statements at the Command Window. MatLab provides a Workspae window for display or exporing variables available in the working space and an Array Editor for exploring or editing each individual variable in the working space. Besides, variable can also be manuipulated by typing statements and commands at the Command Window.  Command examples:

  • who: to list the variable names available in the current workspace

  • whos: to list all available variables with information, e.g. name, size, bytes, etc., in the current workspace

  • VARIABLENAME: to display the value of the variable or array specified by the name of variable, VARIABLENAME.

  •  clear: to clear or remove all variables from the workspace.

  • ans: to store the most recent result evaluated by MatLab when the statement of expression is not assigned to anything. ans is the name of automatically created variable where ans stands for answer.

  • save: to save all workspace variables to the binary "MAT-file" named "matlab.mat" in the current directory

  • save FILENAME: to save all workspace variables to the binary "MAT-file" specified by the name FILENAME  in the current directory

  • load:  to load all workspace variables from the binary "MAT-file" named "matlab.mat"  in the current directory

  • load  FILENAME:  to load workspace variables from the binary "MAT-file" specified by the name FILENAME in the current directory

Useful Commands

  • Running MatLab demos

    • demo: to open the first page of the list of available demos on the Demo tab in the Help Browser

  • Clearing Windows,

    • clc: to clear the contents of the Command Window

    • clf to clear the contents of the Figure Window

  • Stopping running scripts

    • Ctrl-C: to abort or stop a runnng script, where Ctrl-C means hold down the Control and C keys simultaneously.
  • Logging sessions

    • diary: to toggle the diary state of the logfile system. When diary state is ON, MatLab copys all subsequent Command Window input and most of the Command Window result output and then appends to the file, named 'diary', if no file name is speciifed.

    • diary OFF: to suspends the logging process.

    • diary ON: to turn on the logging process.

  • Manipulating command history
    • UPARROW: to recall previous commands by moving one single command line backward along the Command History where UPARROW is the "UPARROW" key.

    • DOWNARROW: to recall previous commands by moving one single command line forward along the Command History where DOWNARROW is the "DOWNARROW" key.

    • CHARS UPARROW: to recall previous commands with first few characters of the command equal to the specified CHARS by moving backward along the Command History.

    • CHARS DOWNARROW: to recall previous commands with first few characters of the command equal to the specified CHARS by moving forward along the Command History.

  • Manipulating working directory

    • cd: to return and display the current working directory.working directory.

    • cd ..: to change the current working directory by moving the directory to the one abouve the current one.

    • cd PATH:  to set the current working directory to the one specified by the PATH.

    • dir: to list the current MatLab working directory

  • Manipulating path

    •  path: to display the current MatLab search path.

    • matlabpath: to display the current MatLab search path.

  • Running System Commands

    • ! SYSTEMCOMMAND: to pass the specified SYSTEMCOMMAND prefixing by an exclamation point, !,  from MatLab to the underlying Operating System.

Previous Month  APR  2014  Next Month
SMTWTFS
12345
6789101112
13141516171819
20212223242526
27282930

Previous Month  JAN  2010  Next Month
SMTWTFS
12
3456789
10111213141516
17181920212223
24252627282930
31

Sideway BICK Blog

01/04


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013