When do assignin variables become active?
显示 更早的评论
I have a function which contains the following two lines:
import_file(filename); [a b] = filt(f2,f1,Avg);
The import_file is another function which opens up a file and uses the assignin cmd to set variables into the 'base' MathLab workspace. One of these variables is Avg. If I simply manually enter "import_file(filename)" on the CLI line, things work as expected and Avg shows up as an array. However if I run these two lines inside a function, the second command complains that Avg is an Undefined function or variable 'Avg'. It acts like it is hurrying on before Avg actually does get set into the base workspace.
I tried using the waitfor(Avg) command, but that doesn't seem to wait for Avg to appear in the base workspace and then continue.
How do I fix this?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!