How to load matrix variables as constant on Simulink?
조회 수: 49 (최근 30일)
이전 댓글 표시
I am trying to load matrix variables on simulink as constant value from '.mat' file. Is it possible to load MATLAB variables on Simulink and use it as constant block value? All variables are N-d array. I found that there are several ways to load a variable on Simulink such as "From File Block" or "Input Port", but It did not work for my project.
댓글 수: 0
채택된 답변
Jonas
2021년 8월 26일
Load the .mat file into the Base Workspace of MATLAB, and in Simulink use the From Workspace block to enter the variable name there.
댓글 수: 3
Jonas
2021년 8월 30일
편집: Jonas
2021년 8월 30일
Ah, if your Matrix is just a time-invariant constant, you can use a 'Constant' block, and as a value enter the name of your matrix variable. The From Workspace block is to read and sample a variable from the base workspace, so indeed the purpose is different.
Like here, I have the variable 'decimation' in the base workspace and I can just use it in my model through a Constant block.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!