simulink

Share data between multiple c mex s-functions

对着背影说爱祢 提交于 2019-12-13 20:30:42
问题 I am implementing several c s-functions. They have to rely on the same pointers and variables, inedependet of the current s-function. Basically I want to instantiate all variabels and pointers in one "setup" s-function (inside mdlInitialize) and then be able to use these variables an pointers in different s-functions in their mdlOutputs function. Every s-function will be written in c. I could not find any usefull hint in the mathworks help. Do you have any idea? Thanks. 回答1: There are several

How to properly propagate multiplex signal names to scope legend via bus system? (Simulink)

為{幸葍}努か 提交于 2019-12-13 13:20:30
问题 I substituted my originial question, the problem is still the same, but the conditions are now different. To review the original question, have a look at the revisions. I'm looking for a way to interactively select the signals I want to get displayed in my scope Block. The Bus Selector Block with the property Output as Bus does exactly that. I can select all desired signals conveniently without changing any block or signal dimensions. But the scope block can obviously not handle properly

signal generation model in Simulink from matlab

不想你离开。 提交于 2019-12-13 09:17:45
问题 How do I generate following signal in simulink: t=(0:1000)/1000*10*pi; I want to build the model of the following matlab code: t=(0:1000)/1000*10*pi; x = (t).*sin(t); y = (t).*cos(t); z = t; 回答1: This is fairly basic stuff. Have you gone through any Simulink tutorial, introduction videos/webinars or even the getting started guide of the documentation? Here are a few suggestions to help you answer your question: Set the stop time of your model to 1000s and use a fixed-step solver with a step

Why is one ans removed when assigning simulink/matlab?

天涯浪子 提交于 2019-12-13 07:07:34
问题 Why is one ans removed when I assign y? I want to return the two descriptions. x = rmi('get',gcs) x = 2x1 struct array with fields: doc id linked description keywords reqsys >> x.description ans = FirstReq ans = SecondRec >> y = x.description y = FirstReq >> y y = FirstReq 回答1: You probably need to use the {} : >> x.description ans = FirstReq ans = SecondRec >> y = {x.description} y = { [1,1] = FirstReq [1,2] = SecondRec } You can then index into y using either () (output will be a cell array

Simulink Simscape simple circuit not working

与世无争的帅哥 提交于 2019-12-13 05:20:12
问题 I am new to Matlab and I'm trying to make a simple circuit in Simulink library Simscape. I have an AC voltage source with RMS value 50V and frequency 50Hz. But as shown in the image, the scope displays a noise, not a sine wave as I expected. What could be the problem? Thanks. 回答1: No, the scope does display the correct signal, which is a sine wave at 50Hz. 50Hz corresponds to a period of 20ms, so if you want to see the sine wave correctly, you need to zoom in until you have a sufficient

MATLAB deploytool simulink Undefined function 'load_system'

随声附和 提交于 2019-12-13 04:35:40
问题 I am using a MATLAB m file code which loads a simulink file, runs it and evaluats it so many times inside a complicated parallel loop. It runs perfect at MATLAB environment. When compiling the code via deploytool command, installing it and running it from command line, I would have a difficult time. At the line where it is loading the model, mymodel= ... ; load_system(mymodel); I get the following error C:\Program Files\mymain\application>Warning: Name is nonexistent or not a directory: model

How do I get the value of a Simulink struct from the workspace within a MATLAB function?

故事扮演 提交于 2019-12-13 03:51:54
问题 I need to access the values of variables in MATLAB's workspace of type Simulink.parameter : CAL_vars = dsdd('find','/path/CAL','ObjectKind','Variable','Property',{'name' 'Class' 'value' 'CAL'}) %gets ids of variables in data dictionary i = 10 for i=1:length(CAL_vars) var_name = dsdd('GetAttribute',CAL_vars(i),'name'); % gets names of variables in data dict var_eval = eval(var_name); % this works in standalone script and it does exactly % what I need, but once i put it in the function I need

find_system returns objects that are not subsystems in simulink?

亡梦爱人 提交于 2019-12-13 02:48:01
问题 When I use find_system(gcs,'BlockType','SubSystem') it returns things that are not subsystems (AFAIK) In my case the things that are called subsys L1 -x and SubsysX L2 - z are subsystems, but the names are just for debugging purpose, so I can't use the names to match. Why is [1x51 char] and Sine and RealisesUID appearing? I only want the subsystems showing up in the Model Browser tree. 'test_simulinkmodel/RealisesUID' 'test_simulinkmodel/subsys L1 - 1' [1x51 char] 'test_simulinkmodel/subsys

No supported Visual C/C++ compiler found. Check your installation of Visual C/C++

给你一囗甜甜゛ 提交于 2019-12-13 02:26:10
问题 I am using Matlab R2013a. The problem appears when I try to use Simulink Coder to generate Visual C++ code. I've got this error even though I have Visual Studio 2013 installed on my computer already. When I look at list of programs that are installed on my computer I see Visual C++ 2008, 2010 and 2012. When I type the command mex -setup Matlab just can see a compiler LCC. But I need a Visual C++ compiler (which , technically, I already have) seen by Matlab. How can I do that? Isn't mex -setup

The function 'edge' is not supported for standalone code generation

和自甴很熟 提交于 2019-12-13 01:27:24
问题 I am trying to use the edge(I,'sobel') method inside a Matlab function block in Simulink(MATLAB 2013a). When I try to compile, I get the error "The function 'edge' is not supported for standalone code generation". I know there is an edge detector block , but I want to call the function with in the Matlab function block. How to get around this. 回答1: If you have Computer Vision System toolbox you can use vision.EdgeDetector System object. If you have edge detector block then you already have