フィルターのクリア

Execute a function call in GUIDE

1 回表示 (過去 30 日間)
Amanda
Amanda 2012 年 9 月 2 日
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

回答 (1 件)

Image Analyst
Image Analyst 2012 年 9 月 2 日
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 件のコメント
Amanda
Amanda 2012 年 9 月 2 日
編集済み: Amanda 2012 年 9 月 2 日
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 2012 年 9 月 2 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by