필터 지우기
필터 지우기

How to use a variable from pop up menu callback to another callback functions like slider?

조회 수: 3 (최근 30일)
I made a popupmenu in GUI with tag Joint_PopUP like following. Whenever I select 'Head' or 'Head_End' from popupmenu, I make changes in 6 arrays of values. I want to use these 6 arrays of values inside another slider callback function in some calculation.
function Joint_PopUp_Callback(hObject, eventdata, handles)
% hObject handle to Joint_PopUp (see GCBO)
handles.Import_CSV;
str = get(hObject, 'String');
val = get(hObject,'Value');
switch str{val};
case'Head'
R_X=handles.Import_CSV(:,1); % I want to use this R_X array in slider callback for some calculation
R_Y=handles.Import_CSV(:,2); % I want to use this R_Y array in slider callback for some calculation
R_Z=handles.Import_CSV(:,3);
T_X= handles.Import_CSV(:,4)/100;
T_Y= handles.Import_CSV(:,5)/100;
T_Z= handles.Import_CSV(:,6)/100;
% handles.RX=R_X
case'Head_End'
R_X=handles.Import_CSV(:,7); % I want to use this R_X array in slider callback for some calculation
R_Y=handles.Import_CSV(:,8); % I want to use this R_Y array in slider callback for some calculation
R_Z=handles.Import_CSV(:,9);
T_X= handles.Import_CSV(:,10)/100;
T_Y= handles.Import_CSV(:,11)/100;
T_Z= handles.Import_CSV(:,12)/100;
end
how do I use those arrays inside another slider callback as shown below?
if true
function StartPointSlider_Callback(hObject, eventdata, handles)
% hObject handle to StartPointSlider (see GCBO)
handles.Import_CSV;
[m,n] =size(handles.Import_CSV(:,1));
set(handles.StartPointSlider,'Max',m);
set(handles.StartPointSlider,'Min',0);
val=get(hObject,'Value');
set(handles.Start_Point_Show,'String',num2str(val));
%R_X %here i need the array from one of the case of popup menu that is already selected
%R_Y %here i need the array from one of the case of popup menu that is already selected
% I do some calculations & plotting ....
guidata(hObject, handles);
end

답변 (1개)

Walter Roberson
Walter Roberson 2018년 4월 18일

카테고리

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