simulink

How to programmatically 'Print to figure' in a Simulink Scope

倾然丶 夕夏残阳落幕 提交于 2019-12-11 23:56:17
问题 Inside a Simulink Scope , it is possible to select Print to Figure . This will open a figure with the same content as the original scope. Is there a way to perform this action programmatically? See also this help page, this help page and this page. 回答1: Depends a little on how fancy you want/need to get. If you really want to use exactly the same code as the UI callback then you'll need to investigate how to use the callback functions in the following directory/package: MATLABROOT\toolbox

Some help writing a s-function to read data from serial port

主宰稳场 提交于 2019-12-11 19:09:40
问题 After problems I had here, I need some help to write a function with MATLAB Function block. I saw in following links that some people solved it with that block or s-function: http://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/317910 http://www.physicsforums.com/showthread.php?t=595813 http://www.mathworks.de/matlabcentral/newsreader/view_thread/250266 So I tried with this: function y = fcn(u) coder.extrinsic('only3') coder.extrinsic('serial', 'fopen','fread') coder.extrinsic('set

How to use fmincon to optimize the objective fun with constraint variables from Simulink model?

北城余情 提交于 2019-12-11 18:46:18
问题 I have build a Simulink model for the dynamic and kinematic modeling of the vehicle, the vehicle has to track a reference trajectory, So the objective of the optimization is to minimize the error defined by (y) in "objec_Fun". And the constraint of the vehicle motion is the linear speed, angular speed, linear acceleration, and angular acceleration defined by (c) in "constraint_Fun". And the design parameter is the controller gains. the vehicle linear and angular speeds must be reached to 8 m

I want to run two or more simulink model in parallel and synchronisation.

徘徊边缘 提交于 2019-12-11 18:08:14
问题 Hi I want to run two or more simulink model in parallel and synchronisation. is there any way to do it? One way I think is by creating a subsystem and put all models inside it. It should run parallely. This one is not prefered for me. I want to open two matlab instances and run two different model in synchronisation. is this possible? I want to do it programmatically. Any help is appreciable. 回答1: You should use a matlab script and implement the synchronization logic in it. == Update == You

simulink saves data in excel during simulation

六眼飞鱼酱① 提交于 2019-12-11 15:37:11
问题 There was a similar topic How to export Simulink data to the MATLAB Workspace during simulation?. pm82 answered that this is possible using set and get commands. But I didn't understand how to use timer callbacks to read the data! Can anyone pls explain it to me? However, in the above question they discussed how to write Simulink data into the MATLAB Workspace. I want Simulink to write data into Excel during the simulation so that that data can be read by another application in real-time. Is

Problem with Parallel-to-Serial block in Simulink

こ雲淡風輕ζ 提交于 2019-12-11 13:32:46
问题 I am trying to convert the input word coming out of the DQPSK Demodulator (Type : UFix2_0) to a serial stream. So I am using the Parallel-to-Serial Block of Xilinx Library in Simulink. But I am not able to use the block, I get the following error : "The Simulink system period" setting on this System Generator token is not appropriate for the rates used in the design. The current setting is: 1 An appropriate setting is: 1/2 " I tried to change the setting the System Generator as well, but It

How to get block handle of Interpreted Matlab function from its .m function

久未见 提交于 2019-12-11 12:44:06
问题 I have an interpreted MATLAB function in my Simulink model. I want to get the block handle or port-handle of this block from user defined .m function implemented in it (say it test.m ). I tried h = get_param(gcb, 'PortHandles'); % for port handle b = gcbh ; % for block handle Both gives port handle/block handle for recently clicked block, which I don't want. I want the port handle/Block handle of the interpreted MATLAB function, which is executing this code via .m function ( test.m ). Is

How do I set Simulink coder compiler version to one that supports C++11?

半腔热情 提交于 2019-12-11 12:34:38
问题 I've got code I'm trying to incorporate into Simulink and its embedded coder. The code uses C++11 extensions. Running mex -setup c++ gives this output: $ mex -setup c++ MEX configured to use 'Xcode Clang++' for C++ language compilation. When I build I get a series of C++11 warnings ( -Wc++11-extensions ), so it would appear that the compiler that Simulink is using is not the default one, which is this: $ clang --version Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) Target:

Command to show open a Simulink model and focus on a specific block

删除回忆录丶 提交于 2019-12-11 10:46:22
问题 I've got a long list of comments in a separate document that refer the named subsystem blocks within a Simulink model. I'm going to process the document with a script that will generate a browser-viewable page, with each block name clickable - such that when you click on the block name, Matlab will launch using a CLI command, and display the model which the comment refers to. The document generation and shell function call is all working, but I can't find a command that will centre on a

Multi-Instance usage of S-Functions (C code) in SIMULINK

孤街浪徒 提交于 2019-12-11 09:57:33
问题 I have a legacy C function in my SIMULINK model that uses some static variables in its functions. The static variables are available globally. When I reference multiple instance of my model, I get error because my S-function is not configured for that. I am getting this error message because code generation doesn't allow this. The error message I get is the following: The S-Function block 'ECDCTRL/PULDESC/S-Function Builder' is not supported in multi-instance Normal mode because it does not