필터 지우기
필터 지우기

how to assign the value of a variable with push button?

조회 수: 2 (최근 30일)
Erwin Avendaño
Erwin Avendaño 2017년 11월 3일
답변: Walter Roberson 2017년 11월 3일
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

채택된 답변

Walter Roberson
Walter Roberson 2017년 11월 3일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by