필터 지우기
필터 지우기

How to use pushbutton and popupmenu

조회 수: 1 (최근 30일)
Efren Lema
Efren Lema 2015년 8월 21일
댓글: Adam 2015년 8월 21일
to use , pushbutton position data from a .csv and I can manipulate and store in any variable but when I go to the function no longer exists popupmenu this variable the code is as follows.
function pushbutton1_Callback(hObject, eventdata, handles) %Cargar archivo *.csv
[nombre direccion]=uigetfile('*.csv','Escoger Archivo *.CSV');
if nombre==0
return
end
EEGDATOS1=importdata(fullfile(direccion,nombre));
EEGDATOS1=EEGDATOS1.data;
function popupmenu_Callback(hObject, eventdata, handles)
EEGDA=EEGDATOS1 % in this line gives me the error HELP
T7=EEGDA(:,2:2);
%%Frecuencia de Muestreo y tiempo
Fs=128;
T=1/Fs;
tiempo=size(T7)/Fs;
tt=0:1/Fs:tiempo;
H=get(handles.EscogerElectrodo,'Value')
switch H
case 2 % AF3
set(handles.mensaje,'String','AF3')
drawnow();
case 3 % F7
set(handles.mensaje,'String','F7')
drawnow();
otherwise
end

채택된 답변

Adam
Adam 2015년 8월 21일
편집: Adam 2015년 8월 21일
You need
handles.EEGDATOS1 = EEGDATOS1
guidata( hObject, handles )
at the end of your pushbutton callback and
EEGDA = handles.EEGDATOS1
at the start of your popup menu callback.
Each function in a GUI, just like functions anywhere else that are not nested, has its own scope and workspace. Once the function ends so does its workspace. The call to the guidata function updates the UI's 'handles' structure onto which has now been added your data.
  댓글 수: 2
Efren Lema
Efren Lema 2015년 8월 21일
thanks , I was proving but I error
guidata( hObject, handles )
Adam
Adam 2015년 8월 21일
Oops, yes, I made a typo in my answer originally there

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by