📄 youhua.m
字号:
Frame1Position = [FrameXPos FrameYPos FrameWidth FrameHeight] ;
% generate a frame .
TitleHandle = uicontrol(FigureHandle,'style','frame', 'Units','pixels',...
'position',Frame1Position );
TextXPos = Frame1Position(1) + 15 ;
TextYPos = Frame1Position(2) + Frame1Position(4) - 12 ;
TextWidth = 100 ;
TextPosition = [TextXPos TextYPos TextWidth TextHeight] ;
% subtitle: 输入初始状态(0度)时的参数
ButtonHandle = uicontrol( 'Parent', FigureHandle, 'Units', 'Pixels', 'Position', TextPosition, ...
'Style', 'pushbutton', 'Tag','pushbotton2', 'string', '卸料性约束', 'Fontsize',12, ...
'Callback', 'Youhua(''pushbotton2_Callback'',gcbo)' ) ;
TextXPos = Frame1Position(1) + 15 ;
TextYPos = Frame1Position(2) + Frame1Position(4) - 80;
TextWidth = 300 ;
TextPosition = [TextXPos TextYPos TextWidth 60] ;
SubtitleHandle = uicontrol(FigureHandle, 'Style','text', 'Units','pixels',...
'position',TextPosition,'Horizontal','left',...
'string', '车厢的最大举升角a,已在总体设计中确定,为保证a值的实现,举升油缸工作行程应满足如下约束 |CO2|-S。<=S', 'fontsize',13 );
FrameXPos = TabSpace * 2+350 ;
FrameWidth = (FigureWidth - TabSpace * 6) * 0.5 ;
FrameHeight = 90 ;
FrameYPos = TitlePosition(2) - FrameHeight - TabSpace * 2 -120;
Frame1Position = [FrameXPos FrameYPos FrameWidth FrameHeight] ;
% generate a frame .
TitleHandle = uicontrol(FigureHandle,'style','frame', 'Units','pixels',...
'position',Frame1Position );
TextXPos = Frame1Position(1) + 15 ;
TextYPos = Frame1Position(2) + Frame1Position(4) - 12 ;
TextWidth = 100 ;
TextPosition = [TextXPos TextYPos TextWidth TextHeight] ;
% subtitle: 输入初始状态(0度)时的参数
ButtonHandle = uicontrol( 'Parent', FigureHandle, 'Units', 'Pixels', 'Position', TextPosition, ...
'Style', 'pushbutton', 'Tag','pushbotton3', 'string', '紧凑型约束', 'Fontsize',12, ...
'Callback', 'Youhua(''pushbotton3_Callback'',gcbo)' ) ;
TextXPos = Frame1Position(1) + 15 ;
TextYPos = Frame1Position(2) + Frame1Position(4) - 80;
TextWidth = 300 ;
TextPosition = [TextXPos TextYPos TextWidth 60] ;
SubtitleHandle = uicontrol(FigureHandle, 'Style','text', 'Units','pixels',...
'position',TextPosition,'Horizontal','left',...
'string', '为保证机构紧凑,除在边界约束中进行了一些限制外,还应建立B,C点的约束', 'fontsize',13 );
FrameXPos = TabSpace * 2+350 ;
FrameWidth = (FigureWidth - TabSpace * 6) * 0.5 ;
FrameHeight = 120 ;
FrameYPos = TitlePosition(2) - FrameHeight - TabSpace * 2 -240;
Frame1Position = [FrameXPos FrameYPos FrameWidth FrameHeight] ;
% generate a frame .
TitleHandle = uicontrol(FigureHandle,'style','frame', 'Units','pixels',...
'position',Frame1Position );
TextXPos = Frame1Position(1) + 15 ;
TextYPos = Frame1Position(2) + Frame1Position(4) - 12 ;
TextWidth = 100 ;
TextPosition = [TextXPos TextYPos TextWidth TextHeight] ;
ButtonHandle = uicontrol( 'Parent', FigureHandle, 'Units', 'Pixels', 'Position', TextPosition, ...
'Style', 'pushbutton', 'Tag','pushbotton4', 'string', '协调性约束', 'Fontsize',12, ...
'Callback', 'Youhua(''pushbotton4_Callback'',gcbo)' ) ;
TextXPos = Frame1Position(1) + 15 ;
TextYPos = Frame1Position(2) + Frame1Position(4) - 100;
TextWidth = 300 ;
TextPosition = [TextXPos TextYPos TextWidth 80] ;
SubtitleHandle = uicontrol(FigureHandle, 'Style','text', 'Units','pixels',...
'position',TextPosition,'Horizontal','left',...
'string', '1 传动性约束 任意举升位置传动角 10<= b <=170 2 不干涉性约束 任意位置时C点不能与车厢底板相碰 即D>=d ', 'fontsize',13 );
% define the parameters of the buttons .
ButtonString = { '上一步'; '导入'; '保存'; '下一步' } ;
ButtonTag = { 'PreviousButton'; 'LoadButton'; 'SaveButton'; 'NextButton' } ;
ButtonCallback = { ['Youhua(''PreviousButton_Callback'',gcbo)']; ...
['Youhua(''LoadData_Callback'',gcbo)']; ...
['Youhua(''SaveData_Callback'',gcbo)']; ...
['Youhua(''NextButton_Callback'',gcbo)'] } ;
ButtonWidth = 80 ;
ButtonHeight = 25 ;
ButtonXPos = FigureWidth - ButtonWidth * 4 - TabSpace * 6 ;
ButtonYPos = TabSpace * 2 ;;
ButtonPosition = [ButtonXPos ButtonYPos ButtonWidth ButtonHeight] ;
for num = 1: 4
TempButtonPosition = ButtonPosition ;
TempButtonPosition(1) = TempButtonPosition(1) + (num - 1) * (ButtonWidth + TabSpace) ;
% generate the pushbutton: OK .
ButtonHandle = uicontrol( 'Parent', FigureHandle, 'Units', 'Pixels', 'Position', TempButtonPosition, ...
'Style', 'pushbutton', 'Tag',ButtonTag{num}, 'string', ButtonString{num}, 'Fontsize',12, ...
'Callback', ButtonCallback{num} ) ;
end
handles = guihandles( FigureHandle ) ;
guidata( FigureHandle, handles ) ;
% --------------------------------------------------------------------------
function init_FigureContent( h )
handles = guidata( h ) ;
% --------------------------------------------------------------------------
function pushbotton1_Callback( h )
handles = guidata( h ) ;
% get the T_SimulationData .
T_SimulationData = getappdata( handles.Youhua, 'T_SimulationData' ) ;
if isempty( T_SimulationData )
T_SimulationData = T_youhua( 'Get_DefaultT_SimulationData' ) ;
end
bianjie( T_SimulationData );
% --------------------------------------------------------------------------
function pushbotton2_Callback( h )
handles = guidata( h ) ;
% get the T_SimulationData .
T_SimulationData = getappdata( handles.Youhua, 'T_SimulationData' ) ;
if isempty( T_SimulationData )
T_SimulationData = T_youhua( 'Get_DefaultT_SimulationData' ) ;
end
xieliao( T_SimulationData );
% --------------------------------------------------------------------------
function pushbotton3_Callback( h )
handles = guidata( h ) ;
% get the T_SimulationData .
T_SimulationData = getappdata( handles.Youhua, 'T_SimulationData' ) ;
if isempty( T_SimulationData )
T_SimulationData = T_youhua( 'Get_DefaultT_SimulationData' ) ;
end
jincou( T_SimulationData );
% --------------------------------------------------------------------------
function pushbotton4_Callback( h )
handles = guidata( h ) ;
% get the T_SimulationData .
T_SimulationData = getappdata( handles.Youhua, 'T_SimulationData' ) ;
if isempty( T_SimulationData )
T_SimulationData = T_youhua( 'Get_DefaultT_SimulationData' ) ;
end
xietiao( T_SimulationData );
%-------------------------------------------------------------
function LoadData_Callback( h )
handles = guidata( h ) ;
PromptString = '选择数据文件.' ;
WarningString1 = '文件格式出错。 ' ;
WarningString2 = '选择的文件不是正确的数据文件。 ' ;
[ FileName , PathName ] = uigetfile( {'*.mat','数据文件(*.mat)'}, PromptString ) ;
if FileName == 0
return ;
else
[TempPathName, FileName, FileTypeName, Version] = fileparts( FileName ) ;
if ~strcmp( FileTypeName, '.mat' ) ;
warndlg( WarningString1, '警告', 'modal' ) ;
return ;
end
SaveFile = fullfile( PathName, [FileName, FileTypeName, Version] ) ;
end
T_SimulationData = [] ;
try
load( SaveFile, 'T_SimulationData' ) ;
catch
end
if isempty( T_SimulationData ) | ~isstruct( T_SimulationData );
warndlg( WarningString1, '警告', 'modal' ) ;
return ;
end
% save the data .
setappdata( handles.Youhua, 'T_SimulationData', T_SimulationData ) ;
% display the new data .
init_FigureContent( h ) ;
% --------------------------------------------------------------------------
function SaveData_Callback( h )
handles = guidata( h ) ;
% get the T_SimulationData .
T_SimulationData = getappdata( handles.Youhua, 'T_SimulationData' ) ;
PromptString = '保存数据文件.' ;
MessageString = '保存数据文件成功。 ' ;
[ FileName , PathName ] = uiputfile( {'*.mat','数据文件(*.mat)'}, PromptString ) ;
if FileName == 0
return ;
else
[TempPathName, FileName, FileTypeName, Version] = fileparts( FileName ) ;
if ~strcmp( FileTypeName, '.mat' ) ;
FileTypeName = '.mat' ;
else
end
SaveFile = fullfile( PathName, [FileName, FileTypeName, Version] ) ;
end
% save the result file .
save( SaveFile, 'T_SimulationData' ) ;
msgbox( MessageString ) ;
% --------------------------------------------------------------------------
function PreviousButton_Callback( h )
handles = guidata( h ) ;
% get the T_SimulationData .
T_SimulationData = getappdata( handles.Youhua, 'T_SimulationData' ) ;
% return the wizard figure .
CalculateStatusEquation( T_SimulationData ) ;
% close the current figure .
pause(0) ;
close( handles.Youhua ) ;
% --------------------------------------------------------------------------
function NextButton_Callback( h )
handles = guidata( h ) ;
% 将鼠标设为等待。
% get the T_SimulationData .
T_SimulationData = getappdata( handles.Youhua, 'T_SimulationData' ) ;
% open the next figure .
if isempty( T_SimulationData )
T_SimulationData = T_youhua( 'Get_DefaultT_SimulationData' ) ;
% save the data .
setappdata( handles.Youhua, 'T_SimulationData', T_SimulationData ) ;
end
yichuan( T_SimulationData ) ;
% close the current figure .
pause(0) ;
close( handles.Youhua ) ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -