From workspace block error

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 个评论

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?
The wave structure is declared within a function. In the same function i call simulink with the sim command.

请先登录,再进行评论。

 采纳的回答

TAB
TAB 2012-5-23

1 个投票

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 个评论

Thank you for your precious advice. It finally worked!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File 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