이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Is there any initialization block for parameters and constants in simulink model to be used throughout the model ?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I know that writting this in matlab script is a way to do it and also creating a variable from simulink is also a way to do it. I think these 2 methods are not neat. I would like to do the opposite have a block to do, initialize all the parameters and constants of the model in simulink. Please let me know what are the ways to do it.
채택된 답변
Fangjun Jiang
2023년 9월 29일
Use a Simulink Data Dictionary (.sldd). Start from here
댓글 수: 17
VIGNESH BALAJI
2023년 10월 27일
I am very confused of how to do it. I read the post and also saw video on youtube.
I am using MATLAB 2021b and I am unable to get this step -
- In the Simulink Editor, on the Modeling tab, under Design, click Link to Data Dictionary.
Can you please show me where to find it ?
Fangjun Jiang
2023년 10월 27일
The UI for each version might be different. At the "Design" group, press the "down arrow".


VIGNESH BALAJI
2023년 10월 27일
I don't understand the point number 10 either
- To open the dictionary, in the Simulink Editor, click the model data badge in the bottom left corner, then click the External Data link. To inspect the contents of the dictionary, in the Model Explorer Model Hierarchy pane, under the External Data node, expand the dictionary node.
I have attached a picture of this

VIGNESH BALAJI
2023년 10월 27일
@Fangjun Jiang From my understanding it looks like, I cannot add / create new variables or constants directly in Data Dictionary. Am I correct ?
Fangjun Jiang
2023년 10월 27일
Yes you can. Open the 'sldemo_fuelsys_dd' demo model. Click the data dictionary icon on the low left corner of the model canvas, and then

VIGNESH BALAJI
2023년 10월 27일
@Fangjun Jiang Thanks a lot for the answer. I got it and able to add new variable / data.
I have a question, Is it possible to use this variable or data inside Matlab Function block directly ? without sending as an input port value to the block and directly using it inside the block as it is in the simulink workspace ?
Fangjun Jiang
2023년 10월 27일
Yes. Inside the MATLAB Function block, add a data, specify it as a "parameter".
VIGNESH BALAJI
2023년 10월 27일
@Fangjun Jiang If I add it a parameter inside the Matlab function block, Will it be automatically be present in my data dictionary ? Can I also use it in other places of my simulink model ?
Did you mean the steps followed in this link - Create and Define MATLAB Function Block Variables - MATLAB & Simulink - MathWorks Benelux
Can you please show a screenshot of it ? I am unable to see that in MATLAB 2021b.
Fangjun Jiang
2023년 10월 27일
For R2021b, see https://www.mathworks.com/help/releases/R2021b/simulink/ug/parameter-arguments-in-matlab-function-block-functions.html
That "parameter" has to come from base workspace, or model worspae, or data dictionary. It can be used anywhere in the model.
VIGNESH BALAJI
2023년 10월 27일
@Fangjun Jiang I am unable to find the Ports & Data Manager block to do this change. Can you please show a screenshot of it. I have been trying this for a long time.
Fangjun Jiang
2023년 10월 28일
이동: Fangjun Jiang
2023년 10월 28일
The button on the top left corner, second image, on this link
VIGNESH BALAJI
2023년 10월 30일
I looked at the image in the same function tab and I don't find the Ports & Data tab anywhere. I have attached a screenshot of it. I also read in other questions that it only shows up while we edit and I tried it too, It didn't come up.

Fangjun Jiang
2023년 10월 30일
No idea. You might have customized toolstrip.
In Simulink, press Ctrl+H to bring up Model Explorer, navigate to the MATLAB Function block on the left. On the right, it is the same UI.
VIGNESH BALAJI
2023년 10월 30일
I have not customised anything atleast knowingly. If you know how to bring back the standard toolbar, let me know. I followed the steps through model explorer and it worked. I need to first add it in External data and mention in function block as a parameter and also have it as an argument to the function.
Thanks and it worked :)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Model Editing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)