From workspace block error

조회 수: 8 (최근 30일)
dimitris
dimitris 2012년 5월 23일
I run the following code : wave.time=t; wave.signals.values = val; wave.signals.dimensions=1; where t and val are vectors. I call a simulink model and a from workspace block reads the wave structure. Then i get Undefined function or variable 'wave' error and i don't know what is wrong. Any ideas would be helpful.
  댓글 수: 2
TAB
TAB 2012년 5월 23일
Where are you declaring wave structure, on command window OR in script OR in function?
How you are running simulink model, directly from simulink GUI or from m-file?
dimitris
dimitris 2012년 5월 23일
The wave structure is declared within a function. In the same function i call simulink with the sim command.

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

채택된 답변

TAB
TAB 2012년 5월 23일
Vaiables declared in a fucntion remains within the function scope, while by default simulink resolve the parameters from base workspace. So either declare the variables in the base workspace or change the parameter source for model to current m-function using simset command.
  댓글 수: 1
dimitris
dimitris 2012년 5월 23일
Thank you for your precious advice. It finally worked!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by