Thursday, January 31, 2008

Matlab (2) - Drawing

Basic functions:
plot mesh

How to query handles of a graph?
findall
findobj
When a handle is obtained, then following function can be used to set properties of the object corresponding to the handle.
set() 

Other functions related to manipulation of handles: 
gcf: get current graph. If no figure exists, MATLAB creates one and returns its handle
gca: get current axes handle.
gco: Return handle of current object
gcbo: Return handle of object whose callback is executing
root object: Root object properties
figure: creates a new figure object using default property values. Figure objects are the individual windows on the screen in which MATLAB displays graphical output.
delete: Delete files or graphics objects
close: deletes the current figure or the specified figure(s).
cla: deletes from the current axes all graphics objects.
clf: deletes from the current figure all graphics objects including axes.
clc: Clear Command Window.
clear:Remove items from workspace, freeing up system memory
home: moves the cursor to the upper-left corner of the Command Window. You can use the scroll bar to see the history of previous functions.
reset: resets all properties having factory defaults on the object identified by h.
hold: determines whether new graphics objects are added to the graph or replace objects in the graph.
ishold: Returns current hold state
newplot: prepares a figure and axes for subsequent graphics commands

load: Load workspace variables from disk
save: Save workspace variables on disk
who, whos: List variables in workspace
workspace:
what: List MATLAB files in current directory
which: Locate functions and files
type: Display contents of file
path: View or change MATLAB directory search path
savepath: Save current MATLAB search path to pathdef.m file
rmpath: Remove directories from MATLAB search path
restoredefaultpath: Restore default MATLAB search path
pathdef: List of directories in MATLAB search path
partialpath:Partial pathname description.A partial pathname is a pathname relative to the MATLAB path, matlabpath. It is used to locate private and method files, which are usually hidden, or to restrict the search for files when more than one file with the given name exists.
fileparts: Return filename parts
fullfile:Build full filename from parts
genpath: Generate path string
pathsep: Return path separator for current platform
filesep: Return directory separator for current platform
addpath: Add directories to MATLAB search path

File operations:
fprintf: Write formatted data to file
fscanf: Read formatted data from file
fclose: Close one or more open files
fopen: Open file, or obtain information about open files
ferror: Query MATLAB about errors in file input or output
fread: Read binary data from file
fwrite: Write binary data to file
fseek: Set file position indicator
ftell: Get file position indicator
feof: Test for end-of-file
fgetl: Read line from file, discarding newline character
fgets: Read line from file, keeping newline character


sprintf
sscanf
int2str
num2str
str2num
hex2num
hex2dec
dec2bin
bin2dec
dec2hex
num2hex
mat2str

format
textread
disp
text

Tools:
pathtool: Open Set Path dialog box to view and change MATLAB path
imtool:

To see the list of factory defaults, use the statement
get(0,'factory')

 

more: Control paged output for Command Window
diary: Save session to file. The diary function creates a log of keyboard input and the resulting text output.
evalc: Evaluate MATLAB expression with capture
eval: Execute string containing MATLAB expression
evalin: Execute MATLAB expression in specified workspace
feval: Evaluate function

function_handle(@):Handle used in calling functions indirectly. E.g. handle = @functionname
functions: Return information about function handle
func2str: Construct function name string from function handle
str2func" Construct function handle from function name string
builtin: Execute built-in function from overloaded method. E.g. builtin('pi'). This function is useful if some of your functions/variables have the same names as built-in functions/variables.
class: Create object or return class of object. E.g.
isa: Determine if input is object of given class. E.g. isa(rand(3,4),'double')

assignin: Assign value to variable in specified workspace

try: Attempt to execute block of code, and catch errors
catch: Specify how to respond to error in try statement.
rethrow:Reissue error
lasterror: Return last error message and related information
lasterr: Return last error message
lastwarn: Return last warning message
warning: Display warning message
error: Display error message
warndlg: Display warning dialog box
dialog: Create and display dialog box
errordlg: Create and display an error dialog box
helpdlg: Create and display help dialog box
questdlg: Create and display question dialog box
inputdlg: Create and display input dialog box
msgbox: Create and display message box
pagesetupdlg: Display page setup dialog box
end: Terminate block of code, or indicate last index of array

dbstop: Set breakpoints
printdlg: Display print dialog box
print, printopt: Create hardcopy output
printpreview:Preview figure to be printed
textwrap: Return wrapped string matrix for given uicontrol

break, for, if, return, switch, while

display: Overloaded method to display text or array
disp: Display text or arrayrat
rats:Rational fraction approximation

isnumeric:Determine if input is numeric array
isfloat isinteger

floor
round
ceil

spy: Visualize sparsity pattern
gplot: Plot set of nodes using an adjacency matrix
sparse: Create sparse matrix
diag: Diagonal matrices and diagonals of a matrix
tril: Lower triangular part of a matrix
triu: Upper triangular part of a matrix
spdiags: Extract and create sparse band and diagonal matrices
full: Convert sparse matrix to full matrix
issparse: Determine if input is sparse
nnz: Number of nonzero matrix elements
nonzeros: Nonzero matrix elements
nzmax: Amount of storage allocated for nonzero matrix elements
size: Array dimensions
isempty:Determine if array is empty
numel: Number of elements in array or subscripted array expression
prod: Product of array elements
cumprod: Cumulative product
cumsum: Cumulative sum
sum
diff: Differences and approximate derivatives
length: Length of vector
ndims: Number of array dimensions
find: Find indices and values of nonzero elements

subsasgn:Overloaded method for A(I)=B, A{I}=B, and A.field=B
subsref:Overloaded method for A(I), A{I} and A.field
substruct:Create structure argument for subsasgn or subsref

exist: Check if variables or functions are defined
computer: Return information about computer on which MATLAB is running
getenv ispc isunix isstudent ver version license

lookfor: Search for keyword in all help entries
doc docopt
help helpwin helpbrowser web

regexp, regexpi: Match regular expression
regexprep: Replace string using regular expression

nargin, nargout: Return number of function arguments

strfind: Find one string within another
findstr: Find string within another, longer string
strmatch: Find possible matches for string
strcmp, strcmpi, strncmp, strncmpi, strvcat

DB family
dbtype: List M-file with line numbers