How to resolve this error ?From GUI executing simulink model

1 回表示 (過去 30 日間)
Arun Badigannavar
Arun Badigannavar 2012 年 12 月 4 日
I am executing a simulink model from gui, and in in the simulink model i have four blocks which send data to workspace,,,am getting thisa error,,how to overcome this?
Error using FinalTest/pushbutton2_Callback (line 41) Cannot create variable 'speed' in workspace
Caused by: Error using FinalTest/pushbutton2_Callback (line 41) Attempt to add "speed" to a static workspace. See MATLAB Programming, Restrictions on Assigning to Variables for details.
Error while evaluating uicontrol Callback

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 4 日
Something you are doing is attempting to "poof" a variable into existance -- that is, attempting to execute a command such as eval() or evalin() or load() with no outputs, which creates a variable without an explicit assignment statement having appeared for the variable. Or, you are trying to run a script from within a function and the script tries to assign values. In some kinds of functions (the better kind), that is an error. The best solution is not to poof at all. In the case of scripts being run from functions, rewrite the scripts as functions that return the values back, or at the very least assign every variable a value before running the script.

その他の回答 (1 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by