How to load matrix variables as constant on Simulink?

63 visualizaciones (últimos 30 días)
관웅 윤
관웅 윤 el 26 de Ag. de 2021
Comentada: 관웅 윤 el 31 de Ag. de 2021
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.

Respuesta aceptada

Jonas
Jonas el 26 de Ag. de 2021
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 comentarios
Jonas
Jonas el 30 de Ag. de 2021
Editada: Jonas el 30 de Ag. de 2021
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.
관웅 윤
관웅 윤 el 31 de Ag. de 2021
Wow, It works well. Thank you!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink Environment Customization en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by