run a script that generates a structure within a function
3 views (last 30 days)
Show older comments
Katherine Gerton
on 1 Jul 2015
Edited: Muthu Annamalai
on 1 Jul 2015
I am creating a GUI that allows you to choose the setup position and calibration files of an experiment then calculate the bidirectional reflectance distribution function (BRDF). Both setup files are .m file scripts, not functions, that output structures to the base workspace when run from the command window. The handle of the structure that is output is setup_date_camera, where setup=position or calibration, date=_month_day_YY_, and camera=VIS1, VIS2, IR1,or IR2. This cannot be changed.
I need to run the scripts within one of my GUI callbacks and store the output structure for use in a different callback. I cannot set the handle of the structure as a persistent variable because the handle of the structure is not defined until the user chooses their setup files. I have tried to preallocate for the structure by separating the date&camera portion from the file name, concatenating the appropriate strings, using eval (I KNOW THIS IS A CRAPPY METHOD) to set the string equal to a blank structure with the appropriate number of blank fields, then running the script but I still get the error: attempting to add 'variable' to a static workspace.
Right now, I have a GUI that works to completion of the BRDF but the user has to go to the command line to run the scripts then I have to evalin the structures for use (I KNOW THIS IS BAD TOO) then continuing the with the GUI. This works, I am just unhappy with the fact that you have to go to the command window to do something when I want the process to be fully automated.
Any help with doing this would be appreciated or, if it cannot be done, let me know so I don't waste any more time. If you need more information, just let me know.
0 Comments
Accepted Answer
Muthu Annamalai
on 1 Jul 2015
Edited: Muthu Annamalai
on 1 Jul 2015
You maybe looking for the evalin function,
currValueOfWorkspaceVar = evalin('base','variableDefinedInBaseWorkSpace')
Ofcourse, this must be sparingly used.
See doc for evalin
0 Comments
More Answers (0)
See Also
Categories
Find more on Entering Commands 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!