フィルターのクリア

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 Center および File ExchangeNumeric Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by