필터 지우기
필터 지우기

File running through GUI not using values from the workspace

조회 수: 1 (최근 30일)
Henry
Henry 2013년 7월 2일
I've got a GUI which runs a file using some values the user has inputed into the GUI. It also uses some variables from the workspace, as defined by a different file.
However, when i try to run this file from the GUI, it tells me that certain variables haven't been defined, dispite them being in the workspace.
It runs fine as per normal, but when I run it from the GUI it seems as though it stops looking at the workspace?
Is this the case? And how do I fix this?
Thanks,
Henry

답변 (1개)

Jan
Jan 2013년 7월 4일
Which "workspace" do you mean? Each function has its own workspace. Is the "file" you run a script or a function? Where are the variables defined in the GUI? If they are created in a callback function, they exist in this callback's workspace as long as it runs only.
  댓글 수: 3
Image Analyst
Image Analyst 2013년 7월 5일
What Jan said is still true. Your second "gui" still won't see the variables. Anyway you said they were already there in the base workspace in your original message, which means that you must have run gui#1 first already so I don't see that your fix did anything different. The only way for your gui#2 to see the variables in the base workspace or gui#1's workspace is to use things like global, setappdata/getappdata, assignin(), etc. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
Henry
Henry 2013년 7월 5일
Sorry, i didn't make myself very clear in the last comment.
the callback runs an .m file which in turn runs another .m file. All the other initial values which my user can't edit are defined in the first .m file and then plugged into the calculations in the second .m file

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by