Execute a function call in GUIDE
1 view (last 30 days)
Show older comments
I have this independent function which runs optimal in the command line:
function datacollect()
filename = uigetfile('*.txt')
[col] = importdata(fileName)
long = columns(:,1)
lat = columns(:,2)
handles.long = long;
handles.lat = lat;
But when I make a function call inside GUIDE:
datacollect()
I get an error:
??? Reference to non-existent field 'output'.
Thanks,
Amanda
0 Comments
Answers (1)
Image Analyst
on 2 Sep 2012
Copy and paste all the red text, don't selectively copy just what you think might be needed. By the way, since datacollect() is an independent function you wrote, it doesn't automatically have access to the handles structure of GUIDE. So you're creating your own handles structure. If you want it to have GUIDE's handle structure, you must pass it in via the arg list, or use other methods described in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
2 Comments
Image Analyst
on 2 Sep 2012
OK, you say "??? Reference to non-existent field 'output'" yet the code you posted didn't even refer to a variable or a field of a structure called output. So where did it get output from? I figure it's because you didn't paste all of your code and error message. In fact I KNOW you didn't paste all of your error message because error messages have a lot more information than you shared, such as line numbers. I'm afraid you left out all the crucial information that would allow us to solve your problem for you. That's why I asked you to copy and paste all the red error test that appears in the command window.
See Also
Categories
Find more on Environment and Settings 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!