Matlab Desktop Command
| Table of Contents |
Matlab Command
- Move Editor to/from Command Window
- Editor to Command / Ctrl-0
- Command to Editor / Ctrl-Shift-0
- Execute DOS command
!command
- Open Current Folder by explorer
!explorer .
- Copy File
!copy <src> <target> copyfile(<src>, <target>
- Remove File
!del <file> delete('<file>') or delete <file> - Move File
!move <src> <target> movefile(<src>,<target>)
- Print contents of File
!more <file> type('<file>') or type <file> - Change direcotry
cd
- Open M-FILE (Error if not-exist)
open <file>
- Edit M-FILE (Create if not-exist)
edit <file>
- Refer working memory
who
- Clear working memory
clear
- Close all figure windows
close all
- Paging output
more on
- Warning off
warning off
- Set output format of numbers
format bank
- Execution time
tic toc
- Stop
pause
- Sleep
pause(sec)
- Print out executed codes in M-file
echo on
would be useful for debugging - Log of command
diary on diary off
Matlab Configuration
Change startup directory
Windows
- Right click shortcut > Property > Change 'Start In'.
- Create startup.m on the default directory, and >> cd <somewhere>
Linux, the current directory is the startup directory.
Install toolbox
addpath <path to the toolbox>
Check with
path
GUI
pathtool
Matlab Execution Options
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/matlabwindows.html
No GUI
matlab -nosplash -nodesktop
or
matlab -nosplash -nojvm
Set environment variable EDITOR to configure editor to use. sh/bash/zsh
export EDITOR=emacs
csh/tcsh
setenv EDITOR emacs
32bit version
-glnx86
Using multiple processors
on matlab
>> maxNumCompThreads(4)
or
>> preferences (shows Preference window)
General->Multithreading > enable 'multithreaded computation' > select 'manual' > type number
Run M-FILE from the command line
matlab -nosplash -nodesktop -r 'a=rand(13);inv(a);save rand_inv;exit'
nohup to run in background
nohup matlab -nosplash -nodesktop -r 'inv(rand(2^13))' < /dev/null > inv.out &
inv.out stores all text shown on the window including
To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.
How to remove?
Run M-function (hoge.m)
function hoge(a,b) a b
matlab -nosplash -nodesktop -r "hoge('foo','bar')"
mcc
>> mcc -m main.m func.m $ ./main.exe
