📜  MATLAB命令

📅  最后修改于: 2021-01-07 02:02:36             🧑  作者: Mango

MATLAB命令

MATLAB是用于数值计算和数据可视化的交互式程序。我们可以通过在命令窗口的MATLAB提示符“ >>”处键入命令来输入命令。

在本主题中,我们将提供常用的通用MATLAB命令列表。

网上帮助

Commands Purpose
help lists topics on which help is available
helpwin opens the interactive help window
helpdesk Opens the web-browser-based help facility
help topic provide help on the topic
lookfor string lists help topics containing a string
demo runs the demo program
lookfor Keyword search for help
doc Online HTML documentation
whatsnew Display ReadMe files
info Info about MATLAB
syntax Help on command syntax
why Give a philosophical device
format Set screen output format
more Control paged screen output
home Send cursor home
echo Echo commands in the script file
↑,↓ Recall previous commands
global Declare variables to be global

变量和工作区信息

Commands Purpose
who lists variables currently in the workspace
whos lists variables directly in the workspace with their size
what lists M-, Mat-, and Mex directories on the disk
clear clear the workspace, and all variables are removed
clear x, y, z clear only variables x, y, and z.
clear all Clears all variables and function from workspace
mlock fun locks function fun so that clear cannot delete it
munlock fun unlocks functions fun so that clear cannot remove it
clc clears command window, cursor shift to the top
home scrolls the command window, cursor moves to the top
clf clear figure window
load Load variable from file
save Save variable in Mat-file
length Length of a vector
size Size of a matrix
pack Consolidate memory space
disp Display text or matrix

处理文件和目录信息

Commands Purpose
pwd shows the current working directory
cd changes the current working directory
dir lists contents of the current directory
ls lists contents of the current files, same as dir
path gets or sets MATLAB search path
editpath modifies MATLAB search path
copyfile copies a file
mkdir creates a new directory
rmdir Remove directory
delete Delete file
diary Save text of MATLAB session
type Show contents of the file
! Access operating system
path List accessible directories
what Lists all MATLAB data in the current directory.
wklread Reads .wk1 spreadsheet file.

一般信息

Commands Purpose
computer tells you the computer type you are using
clock gives you wall clock time and date as a vector
date tells you the date as a string
more control the paged output according to the screen size
ver gives the license and the MATLAB version data
bench benchmarks our computer on running MATLAB compared to other devices

开始并存在

Commands Purpose
^c(Control-c) local abort, kills the current command execution
matlabarc Master start-up file
startup M-file executed at start-up
quit Quit MATLAB
exit same as quit

时间和日期

Commands Purpose
clock Wall clock time
cputime Elapsed CPU time
date Date, month, year
etime Elapsed time function
tic Start stopwatch timer
toc Read stopwatch timer