existence of structure without the use of eval

1 次查看(过去 30 天)
Hello,
I`m trying to see if a structure exists or not in the workspace (i`m checking the structure if it exists in another structure), the name of the structure can be dynamically changed so i used eval.
isfield(eval(struct_name),workspace_variable)
- The problem is that the model updates and compiles when the script hits that line and that is something I don't want.
How can i do this without making the model update ?

回答(1 个)

Oleg Komarov
Oleg Komarov 2012-4-5
have you tried exist cobined with isstruct?
  2 个评论
Adrian Dronca
Adrian Dronca 2012-4-5
I have the same problem and i know why, i`m trying to save some variables in a structure which has the same name as the model.
Then when eval is called it`s trying to evaluate the model.
I will change the way i save the structure if i don't find another way.
Image Analyst
Image Analyst 2012-4-5
Or change the name of it, rather than the way you save it.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by