필터 지우기
필터 지우기

Importing data using MATLAB GUI and Pop-up Menu

조회 수: 5 (최근 30일)
Mikael
Mikael 2013년 8월 26일
Hello everybody,
I am currently, for the first time, working on a project requiring an user interface. For this purpose I am using the MATLAB GUI tool.
I want to import climate data using a pop-up menu. For example it should be possible for the user to select a "Normal year reference" between three countries. So far I can select the country and compare it to a string, thus knowing which has been selected. However, I cannot get the GUI to load my data into the workspace. How can I solve this issue?
Alternatively it would be a possebility to load all data in the beginning of the code, but I have not been able to work that out either.
Any help would be greatly appricated.
Regards Mikael

답변 (2개)

Chong Tao
Chong Tao 2013년 8월 26일
can you post your script, so it will be more specific?

Mikael
Mikael 2013년 8월 26일
편집: Mikael 2013년 8월 26일
Well, so far there isn't really much code. Mostly just a simple layout, as you can see by following the link below:
https://www.dropbox.com/s/okuuf513g5rspyl/interface.PNG
I am going to do some calculations. These calculations are supposed to use a different reference according to the selected country. Therefore the program should read/load a difference dataset depending on the selection.
The code below is the part where the selection is identified:
% --- Executes on selection change in normalref_popup. function normalref_popup_Callback(hObject, eventdata, handles) % hObject handle to normalref_popup (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns normalref_popup contents as cell array
% contents{get(hObject,'Value')} returns selected item from normalref_popup
normalref = cellstr(get(hObject,'String'))
check_dk = strcmp(normalref,'Danmark')
I hope this clarifies things a little.
  댓글 수: 1
Jan
Jan 2013년 8월 26일
Please do not post comments in the section for answers, but as a comment.
It is still not clear to me, where we could help you. In which Workspace should the data be loaded in? A lot of problems with GUIs concern the storage of intermediate data and sharing them between different callbacks. So please search for "share data gui" in this forum at first.

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

카테고리

Help CenterFile Exchange에서 Weather and Atmospheric Science에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by