![]() |
[求助]simulink创建简单的开关模块失败
2 个附件
[SIZE="3"][COLOR="Blue"]用的是《matlab6.5及其在信号处理中的应用》书上的例题。
1、用的模块:on-off子系统,使能子系统,里面是enable模块,使用constant为1 的常值模块驱动。是subsystem外部使能控制信号。使能模块内不必添加其他模块。两个图片 switch_on.jpg和switch_off.jpg。 2、把此子系统封装起来。edit——mask subsystem; 3、在icon页绘图命令行输入image(picture);parameters页添加参量on和off,初始化为On和 Off,不勾选evaluate项。 4、initialization页的初始化代码编辑框(initialization commands)输入初始化代码如下: if strcmp(on,'on') picture=imread('switch_on.jpg'); set_param=([gcb,'/State'],'Value','1'); else picture=imread('switch_off.jpg'); set_param=([gcb,'/State'],'Value','0'); end 4、然后,block properties打开子系统模块的属性对话框,callback页上选择openfcn,编写具 体的回调函数如下: temp=get_param(gcb,'on'); set_param(gcb,'on',get_param(gcb,'off'); set_param(gcb,'off',temp); =====但是,此时提示错误:in an assignment A(:)=B, the number of element in A and B must be the same. 因此,到了第四步,就走不动了,很难啊。怎么办呢?各位帮个忙吧? 如图是错误信息~[/COLOR][/SIZE] |
回复: [求助]simulink创建简单的开关模块失败
中国的科研人员就是如此的通病:求助别人时候,希望别人无私的分享经验,等自己学会了,却又很吝啬的把知识保存起来,视之为知识产权的机密~
|
所有时间均为北京时间。现在的时间是 12:13。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.