필터 지우기
필터 지우기

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 CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by