Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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

Réponses (1)

Walter Roberson
Walter Roberson le 18 Avr 2018
  1 commentaire
ahasan ratul
ahasan ratul le 19 Avr 2018
Thanks for your quick reply. But I have just done it using setappdata() and getappdata().

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by