Effacer les filtres
Effacer les filtres

Execute a function call in GUIDE

1 vue (au cours des 30 derniers jours)
Amanda
Amanda le 2 Sep 2012
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

Réponses (1)

Image Analyst
Image Analyst le 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 commentaires
Amanda
Amanda le 2 Sep 2012
Modifié(e) : Amanda le 2 Sep 2012
I'm confused. I just want to call a function inside GUIDE.
Nice article though. Just need a few other examples...
Image Analyst
Image Analyst le 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by