Matlab-learn(6):switch,for,while

1. switch语句:
switch numgrade
    case {0,1}
        letgrade='A'
    case 2
        letgrade='B'
    otherwise
        letgrade='C'
end
2. isletter()  若是字母返回逻辑正确
3. isempty() 判断矩阵是否为空
4. isa(变量,数据类型) 判断该变量是否为该数据类型
5. iskeyword() 判断某名字是否为关键字
6.循环语句
for i =向量或矩阵。。。
7. 当你将元素存入向量是超过向量容量时,
matlab会删除向量重建一个更长的向量,这样效率低。
ans=NaN(n,1)  实现赋予向量指定大小空间,n列1行

8.subplot(a,b,c)  把画图窗口分成a行b列个画布,并激活第c张画布
subplot(2,2,[2 4])
等效于
subplot(1,2,2)
9. plot(x,y,'LineWidth',5,'DisplayName',['exp(2^'num2str(i)')'])
legend('show') 展示线名
LineWidth 线宽
DisplayName 线名
10. 
while
...
end 
11.
tic
...
你的程序
...
toc
返回程序段执行时间
12.返回多个变量的函数
function [a b]=functionname(输入的变量)
...
end
接收时
[a1 b1]=functionname(c)
['',b1]=functionname(c) 只接收b1
13.无输出变量的函数
function functionname(c)
14. persistent - 定义持久变量
15.  present - Display model information, including estimated uncertainty
    This MATLAB function displays the linear or nonlinear identified model m
    and the following information:

    present(m)
...
end

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

linalw

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值