フィルターのクリア

Creating structure using eval function - Part 2 Question

1 回表示 (過去 30 日間)
Thulasi Durai Durai Samy
Thulasi Durai Durai Samy 2012 年 7 月 6 日
Hello
This time I will make the question more specific
Laminate = struct('Raw', -1, 'ttm', -1, 'USD', zeros(3));
evalin('base','',Laminate,'')
Following error in matlab
??? Undefined function or method 'evalin' for input arguments of type 'struct'.
Error in ==> Laminator_ProV>LamDetailstToWorkSpace at 1405
evalin('base','',Laminate,'')
??? Error while evaluating uimenu Callback
Can some body help me, thanks in advance
  2 件のコメント
C.J. Harris
C.J. Harris 2012 年 7 月 6 日
Are you sure it's 'evalin' you want to use and not 'assignin'?
Thulasi Durai Durai Samy
Thulasi Durai Durai Samy 2012 年 7 月 9 日
Hello I tried with 'assignin'. I was not aware during that time, now I am using 'assignin'. I am satisfied, thanks

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2012 年 7 月 9 日
編集済み: Jan 2012 年 7 月 9 日
Laminate_local = struct('Raw', -1, 'ttm', -1, 'USD', zeros(3));
assignin('base', 'Laminate', Laminate_local)
I've addeded "_local" just to avoid further confusion.
Let me mention that I'd never use ASSIGNIN, EVALIN or their brothers, because they impede the debugging by letting the variables appear magically in the workspace. When these evail commands are used multiple times, it gets impossible to find out, where changes of the values are comming from. Much better, safer, cleaner, faster and nicer is transporting the variables as output of the function.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by