When do assignin variables become active?
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!