How to create an array in simulink?

조회 수: 10 (최근 30일)
László Lindenmaier
László Lindenmaier 2017년 4월 20일
댓글: László Lindenmaier 2017년 4월 20일
Hello! I would like to create an array with zero values, but i would like to define the array size from external port. So the array would be variable-size. I shouldn't use any MATLAB function. Maybe it would be a proper solution, if I could save the size as a global variable, and I could define the array in a Constant block. Is it possible? Or somebody has any idea for the solution of this problem? Thanks!

답변 (1개)

ES
ES 2017년 4월 20일
You can have a workspace variable say
A=5;
and use
zeros(1,A)
as the value in constant block.
  댓글 수: 1
László Lindenmaier
László Lindenmaier 2017년 4월 20일
But unfortunately, its not a workspace variable. The size is crounted by a subsystem in simulink. If i wanted to load from workspace it should be run before this size is used as a workspace variable.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by