Workspace in Matlab shows value not formula
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Stefan Kumpe
el 3 de Mayo de 2021
Comentada: Stefan Kumpe
el 5 de Mayo de 2021
Hello to all friendly people in this forum,
i must be missing something.
When i create a variable in Simulink, it is shown in the Workspace of MatLab.
But instead of the formula, i can only see and edit a decimal number.
Many Thanks.
2 comentarios
Tom Fischer
el 4 de Mayo de 2021
Editada: Tom Fischer
el 4 de Mayo de 2021
Either i create it by clicking on the three dots of any block like Constant or Step --> create Variable --> entering a value
or i create it directly in the MatLab Workspace
Here is shown the first step - when i enter something like "m_dot_in*p*r*d" for the value of m_dot_out,
i can only see and copy the value of the equation.
What i want is to edit the formula, not the value.
Respuesta aceptada
Walter Roberson
el 4 de Mayo de 2021
Editada: Walter Roberson
el 4 de Mayo de 2021
When you do the Create of the variable, give it a nominal value such as 1. Then find the variable in the model "External Data" section of the model explorer, and left click on it. Then right click and select "Convert to parameter object". The far right of the explorer will change to show a Simulink.Parameter configuration. Go over to the Value section (near the top), and type in an = followed by the formula you want, such as
=m_dot_in*p*r*d
The equals-sign is important -- though if you forget it then the interface will give you a warning.
If you look in the Base Workspace, you will now see that m_dot_out has a value similar to
m_dot_out =
Parameter with properties:
Value: slexpr("m_dot_in*p*r*d")
CoderInfo: [1×1 Simulink.CoderInfo]
Description: ''
DataType: 'auto'
Min: []
Max: []
Unit: ''
Complexity: 'auto'
Dimensions: -1
0 comentarios
Más respuestas (1)
Stefan Kumpe
el 5 de Mayo de 2021
2 comentarios
Walter Roberson
el 5 de Mayo de 2021
Code generation, especially for fixed point or HDL, typically tries to remove division, as division is one of the more expensive operations. If you can define "days_per_filling" as the reciprocol of n_fillings_per_day then you can convert to multiplication.
Ver también
Categorías
Más información sobre Interactive Model Editing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!