Simulink指导手册笔记②--快捷键及基本操作

1.快捷键

全选

Ctrl+A

Open the Library Browser Ctrl+Shift+L  打开模块库

仿真,更新,生成代码快捷键

Debug Simulations

2.回调函数  callback

有时候模型内的变量,是从.m文件导入或是工作区间导入,可以使用模块的回调函数

Model Callback Parameters

 

假设有如下两个参数,K需要直接在回调函数中初始化,B需要在.m文件中初始化

点击模型的空白处,点击模型属性,点击PostloadFcn选项卡,把参数和.m文件填在此处,该选项卡代表模型打开之后运行这里的回调函数,对应的还有打开前,初始化,保存等回调函数

新建一个.m脚本

从新打开模型,并运行,可以发现,参数已经自动导入了

3.回退至前版本

当你将模型导出到旧版本时,无论如何保存的模型都会采用旧版本格式(即便该模型包含后续版本引入的模块和功能)。若模型中存在旧版后开发的功能模块,或使用了新版本特性,则该模型在旧版 Simulink 中运行时可能出现结果异常。此时,Simulink 会将新版添加的模块自动转化为黄色、空白的已屏蔽子系统模块,并在模块角标显示警告三角形

4.信号连接

Press Ctrl and right-click the block whose input ports you want to connect.

左边3个信号全选,按Ctrl再用鼠标点击子系统即可一次性连接所有信号

To connect both the input port and output port of a block to an existing signal line, click and drag the block onto the signal line. Position the block such that the port symbols are on the signal line. When the output port symbol disappears and the input port symbol turns into a solid arrowhead, release your pointer

将模块直接拖进信号线中间,松开即可直接插入进去

To make a signal line segment diagonal, press Shift and drag a vertex that connects to another signal line segment.

点击信号线,按住Shift,当鼠标成为圆圈时拖动可改变信号线的形状

To connect an output port to multiple input ports, connect one input port to the output port, then branch the signal line to connect to the other input ports. To branch the signal line, press Ctrl, then click and drag the existing signal line to the input port of the block to which you want to connect.

当两个模块已经连接了,此时需要在信号线中引出一条线连接第3个模块,按住Ctrl不动,直接引线连接

5.goto from模块

For example, the Goto and From blocks are related blocks that you can use to send a signal without a signal line. The signal that enters the Goto block exits the From block without passing through a signal line.

Some related blocks connect using tags. For example, all Goto and From blocks with the same tag are connected.

6.模块大小一致

经常在建模时,为了让输入输出信号大小对齐,有时手动拖动一些模块,导致模块的大小不一致,需要用到大小一致功能

如图,三个大小不一致,按住Shift不动,依次点信号3,2,1最后点1是以1为参照物,把2,3变成和1一样的大小

点击Match Size

7.增加区域

To change the label text of an area, select the area, click the ? in the upper left corner, and type the new label text

To change to color of an area, in the Simulink Toolstrip, on the Format tab, in the Style section, click Foreground. You can select a color from the menu or click Custom Color to define your own color.

增加注释:

Double-click the canvas where you want the annotation. The quick insert menu opens. The default option in the quick insert menu is Create Annotation

配合区域使用注释,线条通过注释直接拉到区域框,可以起补充说明的作用

8.创建视图标记

当一个模块比较大的时候可以创建视图标记来方便查找具体想要查看的子系统

①视图标记创建

例如在如下模型:

点击下图中的照相机图标

进入到子系统内,也电机照相机按钮

点击图库按钮

可以看到刚刚的已经被创建的两个视图标记

②给视图标记命名

在图库内给视图标记命名,这样比如打开一个比较大的子系统,以这个子系统的功能进行命名,将会快速的打开想要查找的功能逻辑

③添加描述或删除该视图

④保存视图标记

先点Manage

勾选想要保存的视图,并点击右上角保存

会发现在该Model下新增了我们保存的视图,在下一次打开该模型时,该视图将会一直存在

9.查找功能

You can use the Finder to perform a keyword search for model elements and parameters. To open the Finder, select the Simulink Editor and press Ctrl+F. In the search box, type a keyword or key phrase, then press Enter. The keyword or key phrase can be any in this table.

### Simulink快捷键插入模式无法输入文字的解决方案 当在 MATLABSimulink 环境下尝试通过快捷键插入对象时如果发现无法输入文字,这可能是由于几种常见原因造成的。一种可能性是当前的操作环境或设置存在冲突。 #### 检查MATLAB版本兼容性 确认所使用的MATLAB 版本是否存在已知的相关Bug。对于特定版本如 Matlab2018 及其更新版可能存在的稳定性问题已有相应的补丁发布[^1]。确保安装最新的服务包和服务更新可以有效减少因软件本身缺陷引起的功能异常。 #### 调整键盘映射与焦点控制 有时键盘布局或某些特殊按键的状态会影响正常的文本录入功能。切换至默认键盘配置并测试是否恢复正常工作流程有助于排除此类干扰因素。另外,在执行任何操作前保证光标位于可编辑区域内也非常重要。 #### 清除缓存数据重置界面状态 临时文件残留可能导致应用程序行为失常。关闭所有打开项目后重启程序,并清除本地存储路径下的`.mat`、`.fig`等中间产物能够帮助恢复初始设定从而改善交互体验。 #### 修改图形窗口属性参数 针对具体绘图组件进行个性化定制可能会引发意想不到的结果。进入Figure Properties对话框逐一排查FontSmoothing、RendererMode等相关选项直至找到影响因子为止;必要情况下将其调整回出厂预设值即可解除限制。 ```matlab set(gcf,'Renderer','painters'); % 切换渲染器类型为 painters ``` #### 更新操作系统驱动程序 硬件层面的因素同样不容忽视。正如提到过的显卡性能优化措施确实能间接提升整体运行效率进而缓解潜在矛盾点。定期访问设备制造商官网下载最新版Display Adapter Drivers不失为明智之举。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值