Error in using variable from MATLAB workspace to Simulink?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
0 votes
- it is a signal, just a constant signal; in that case use 0 as the first column (time); and configure From Workspace to "hold" the signal; OR
- it is something you want to treat as a global variable or datastore variable; OR
- it is something you want to use as a parameter (for example gain for a block)
14 Comments
- know the complete paths to all occurances of the constant block that should use the same value, and set_param() each of them to the new numeric value; or
- define the value of the constant blocks in terms of a name, and use the kinds of techniques I linked to in order define the name as a param (in which case you do not need to know the paths to any blocks)
- run simulation and send Fs to workspace
- from Fs compute the value of a new variable called avg_rocof
- run the simulation again using the value of avg_rocof
- There is no need to mention global variable or datastore variable.
- There is no need to mention set_param(). The need for it would be the same, if using Constant block or "From Workspace" block.
- There is no need to explain the difference between "push" and "pull", if there are any.
- Signal object is irrevelant. It is used to define signal property, not to import value.
- Open simulink
- Create a blank model
- Create a block diagram with a Constant block feeding a To Workspace block
- Double click the Constant block, specify cvalue as the block parameter for "Constant value"
- Click OK on the Block Paramters for the Constant block
- At the matlab command prompt, assign a value to cvalue ">> cvalue = 6.23"
- Simulate the model by clicking the Run button
- After the simulation is complete, what does this command show: >> out.simout.Data
- Regarding auto prompt to create variables, (e.g. in R2022b)
- Regarding workspace
- Regarding Simulink fundamentals document
More Answers (1)
0 votes
3 Comments
Categories
Find more on Event Functions in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)