获得徽章 0
m文件:save和load
function: input(‘表达式’),'s'表示字符串
disp()
pause() pause off/pause on
if elseif
switch 表达式(标量或字符串) case 表达式123(标量字符串或元胞矩阵) otherwise 不用加break
try catch lasterr 试探性 其中总有一个可以实现,如果lasterr返回空字符串则说明try实现,其他则是catch实现
for 循环变量=起始值:步长:终止值
循环体
end
*当循环变量等于矩阵表达式时,依次等于其中元素
循环嵌套与自然筛选法
while表达式
循环体语句
end
break,continue,return不执行后续代码
函数文件基本格式:
function 输出参数列表=函数名(输入参数列表)
注释说明语句段
程序语句段
输出形参多于1个时,要用[ ]
函数递归
nargin和nargout 判断输入/输出参数个数进行函数分类处理
gloabal 变量名 全局变量,不过要在函数文件和命令窗口中都写入
keyboard和menu
设置断点 debug
绘图
plot(x,y,'color','r'or[84 134 135]/255)
plot(x,y,'点形','color','linewidth',...)
hold on
xlabel
ylabel
function: input(‘表达式’),'s'表示字符串
disp()
pause() pause off/pause on
if elseif
switch 表达式(标量或字符串) case 表达式123(标量字符串或元胞矩阵) otherwise 不用加break
try catch lasterr 试探性 其中总有一个可以实现,如果lasterr返回空字符串则说明try实现,其他则是catch实现
for 循环变量=起始值:步长:终止值
循环体
end
*当循环变量等于矩阵表达式时,依次等于其中元素
循环嵌套与自然筛选法
while表达式
循环体语句
end
break,continue,return不执行后续代码
函数文件基本格式:
function 输出参数列表=函数名(输入参数列表)
注释说明语句段
程序语句段
输出形参多于1个时,要用[ ]
函数递归
nargin和nargout 判断输入/输出参数个数进行函数分类处理
gloabal 变量名 全局变量,不过要在函数文件和命令窗口中都写入
keyboard和menu
设置断点 debug
绘图
plot(x,y,'color','r'or[84 134 135]/255)
plot(x,y,'点形','color','linewidth',...)
hold on
xlabel
ylabel
展开
评论
点赞