how to assign the value of a variable with push button?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Erwin Avendaño
le 3 Nov 2017
Réponse apportée : Walter Roberson
le 3 Nov 2017
I would like that by pressing a push button it assigns the value of for example u = 1, so that later that value will use it in another button and it can start my program
get(handles.pushbutton1,u=1);
get(handles.pushbutton3,u=2);
get(handles.pushbutton4,u=3);
get(handles.pushbutton5,u=4);
switch u
case 1
m=[str2double(get(handles.edit3,'string')) str2double(get(handles.edit4,'string'))(str2double(get(handles.edit9,'string'))); str2double(get(handles.edit10,'string')) str2double(get(handles.edit11,'string')) str2double(get(handles.edit15,'string'))];
case 2
m=[str2double(get(handles.edit3,'string')) str2double(get(handles.edit4,'string')) str2double(get(handles.edit6,'string')) (str2double(get(handles.edit9,'string'))); str2double(get(handles.edit10,'string')) str2double(get(handles.edit11,'string')) str2double(get(handles.edit12,'string')) (str2double(get(handles.edit15,'string'))); str2double(get(handles.edit16,'string')) str2double(get(handles.edit17,'string')) str2double(get(handles.edit18,'string')) str2double(get(handles.edit21,'string')) ];
case 3
case 4
otherwise
x=0
end
if all(size(m)==[2,3])
h=1
else
if all(size(m)==[3,4])
h=2
else
if all(size(m)==[4,5])
h=3
else
if all(size(m)==[5,6])
h=4
end
end
end
end
switch h
case 1
m(1,:)=m(1,:)/m(1,1);
m(2,:)=m(2,:)-(m(2,1))*(m(1,:));
m(2,:)=m(2,:)/m(2,2);
m(1,:)=m(1,:)-(m(1,2))*(m(2,:));
x1=m(1,3)
x2=m(2,3)
set(handles.edit35,'string',x1);
set(handles.edit36,'string',x2);
case 2
m(1,:)=m(1,:)/m(1,1);
m(2,:)=m(2,:)-(m(2,1))*(m(1,:));
m(3,:)=m(3,:)-(m(3,1))*(m(1,:));
m(2,:)=m(2,:)/m(2,2);
m(3,:)=m(3,:)-(m(3,2))*(m(2,:));
m(3,:)=m(3,:)/m(3,3);
m(2,:)=m(2,:)-(m(2,3))*(m(3,:));
m(1,:)=m(1,:)-(m(1,3))*(m(3,:));
m(1,:)=m(1,:)-(m(1,2))*(m(2,:));
x1=m(1,4)
x2=m(2,4)
x3=m(3,4)
set(handles.edit35,'string',x1);
set(handles.edit36,'string',x2);
set(handles.edit37,'string',x3);
case 3
x=3
case 4
x=2
otherwise
x=32
end
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Numeric Types dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!