Why am I unable to use a variable from my model workspace as the number of points in a scope?

1 view (last 30 days)
I have a model, which contains a scope block. I have defined a variable k in my model workspace and want to use that number as the amount of datapoints in my scope. However when I try to use EVALIN to set this number to 'k', I receive the following error:
Error using ==> evalin
Undefined function or variable 'k'.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The expression from the 'Limit data points' field is evaluated in the MATLAB base workspace. In order to retrieve the value of k from your model workspace and put it in the base workspace so that the scope has access to it, you need to explicitly call the value from the MATLAB command line:
evalin(get_param(gcs, 'modelworkspace'), 'k')

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2008b

Community Treasure Hunt

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

Start Hunting!