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
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!