?? calculatestatusequation.m
字號:
function varargout = CalculateStatusEquation( varargin )
% this module edit the parameters .
% February 2004
% $Revision: 1.00 $
if (nargin == 0) | isstruct( varargin{1} ) % LAUNCH GUI
if nargin == 1
T_SimulationData = varargin{1} ;
else
T_SimulationData = [] ;
end
% find if have the same figure, and close it .
OldFigure = findobj( 'type', 'figure', 'Tag', 'CalculateStatusEquation' ) ;
if ishandle( OldFigure )
close( OldFigure ) ;
end
% generate a new figure .
FigureHandle = figure( 'Visible', 'off' ) ;
set( FigureHandle, 'Units' , 'pixels', 'Position', [150 150 500 300], ...
'Name', 'T型自卸汽車優(yōu)化分析程序', ...
'Tag', 'CalculateStatusEquation', ...
'FileName' , '' ,...
'MenuBar' , 'none' ,...
'NumberTitle' , 'off' ,...
'Resize', 'off', ...
'windowstyle', 'normal', ...
'Visible', 'off' ) ;
% generate the menu .
generate_MenuContent( FigureHandle ) ;
% generate the uicontrols .
generate_FigureContent( FigureHandle ) ;
% save the T_SimulationData .
setappdata( FigureHandle, 'T_SimulationData', T_SimulationData ) ;
% display the figure .
movegui( FigureHandle, 'center' ) ;
% set( findobj( FigureHandle, 'Type', 'uicontrol' ), 'Units', 'normalized' ) ;
set( FigureHandle, 'Visible', 'on' ) ;
% init the data .
init_FigureContent( FigureHandle ) ;
if nargout > 0
varargout{1} = FigureHandle;
end
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
global SET_DEBUG_VALUE_IN_SIMULATOR ;
if isempty( SET_DEBUG_VALUE_IN_SIMULATOR ) | ~isnumeric( SET_DEBUG_VALUE_IN_SIMULATOR )
SET_DEBUG_VALUE_IN_SIMULATOR = 0 ;
else
end
if SET_DEBUG_VALUE_IN_SIMULATOR == 1 ;
if (nargout)
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
else
feval(varargin{:}); % FEVAL switchyard
end
else
try
if (nargout)
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
else
feval(varargin{:}); % FEVAL switchyard
end
catch
disp(lasterr);
end
end
end
% ------------------------------------------------------------
function generate_MenuContent( FigureHandle ) ;
% generate the file menu .
% ------------------------------------------------------------
MenuHandle = uimenu( 'Parent', FigureHandle, 'Label', '文件(&F)' ) ;
% define the parameters of the menus .
MenuLabel = { '打開(&O)'; '保存(&S)'; '退出(&E)' } ;
% add Polygon at 2003.10.13 .
MenuTag = { 'MenuOpenResult'; 'MenuSaveResult'; 'MenuClose' } ;
MenuCallback = { ['T_youhua( ''MenuOpenHistory_Callback'', gcbf)']; ...
['CalculateStatusEquation( ''SaveResult_Callback'', gcbf)']; ...
['close all;'] } ;
SeparatorGroup = { 'off'; 'off'; 'on' } ;
% generate the uimenus of file .
for num = 1: length( MenuTag )
% for num = 3
UimenuHandle(num) = uimenu( MenuHandle ) ;
set( UimenuHandle(num), 'Tag' , MenuTag{num} , ...
'Callback' , MenuCallback{num} , ...
'Label' , MenuLabel{num} , ...
'Separator', SeparatorGroup{num} ) ;
end
% generate the parameter menu .
% ------------------------------------------------------------
MenuHandle = uimenu( FigureHandle, 'Label', '參數(shù)(&P)' ) ;
% define the parameters of the menus .
MenuLabel = { '導(dǎo)入(&L)'; '保存(&E)' } ;
% add Polygon at 2003.10.13 .
MenuTag = { 'MenuLoadData'; 'MenuSaveData' } ;
MenuCallback = { ...
['CalculateStatusEquation( ''LoadData_Callback'', gcbo)']; ...
['CalculateStatusEquation( ''SaveData_Callback'', gcbo)']; } ;
SeparatorGroup = { 'off'; 'on' } ;
% generate the uimenus of file .
for num = 1: length( MenuTag )
UimenuHandle(num) = uimenu( MenuHandle ) ;
set( UimenuHandle(num), 'Tag' , MenuTag{num} , ...
'Callback' , MenuCallback{num} , ...
'Label' , MenuLabel{num} , ...
'Separator', SeparatorGroup{num} ) ;
end
% generate the parameter menu .
% ------------------------------------------------------------
MenuHandle = uimenu( FigureHandle, 'Label', '幫助(&H)', 'Enable', 'on' ) ;
% define the parameters of the menus .
MenuLabel = { '幫助(&P)'; '演示(&D)'; '關(guān)于(&A)';'時鐘(&S)' } ;
% add Polygon at 2003.10.13 .
MenuTag = { 'MenuHelp'; 'MenuDemo'; 'MenuAbout';'shijian' } ;
MenuCallback = { ...
['T_youhua( ''MenuHelp_Callback'', gcbo)']; ...
['T_youhua( ''MenuDemo_Callback'', gcbo)']; ...
['T_youhua( ''MenuAbout_Callback'', gcbo)'];...
['T_youhua( ''shizhong'', gcbo)']} ;
SeparatorGroup = { 'off'; 'on'; 'on'; 'on' } ;
% generate the uimenus of file .
for num = 1: length( MenuTag )
UimenuHandle(num) = uimenu( MenuHandle ) ;
set( UimenuHandle(num), 'Tag' , MenuTag{num} , ...
'Callback' , MenuCallback{num} , ...
'Label' , MenuLabel{num} , ...
'Separator', SeparatorGroup{num} ) ;
end
% ------------------------------------------------------------
function generate_FigureContent( FigureHandle )
% generate the uicontrols .
% init the variables .
FigureWidth = 700 ;
FigureHeight = 500 ;
TabSpace = 10 ;
TextHeight = 22 ;
ChangeYPos = 30 ;
% reset the figure's size .
set( FigureHandle, 'Units', 'pixels', ...
'Position', [150 150 FigureWidth FigureHeight], ...
'DoubleBuffer', 'on' ) ;
% generate the axes to plot lines .
AxesHandle = axes( 'Parent', FigureHandle, 'Units' , 'normalized' , ...
'Position', [0 0 1 1], 'Visible', 'off', ...
'Xlim', [0 FigureWidth], 'Ylim', [0 FigureHeight] ) ;
% get the color of the figure .
FigureColor = get( FigureHandle, 'Color' ) ;
% reset the default value of the uicontrols .
set(FigureHandle,'defaultuicontrolunits','normalized');
set(FigureHandle,'defaultuicontrolfontname','隸書');
set(FigureHandle,'defaultuicontrolBackgroundColor', FigureColor );
TitleXPos = TabSpace ;
TitleWidth = FigureWidth - TabSpace * 1.5 ;
TitleHeight = 25 ;
TitleYPos = FigureHeight - TitleHeight - TabSpace * 1 ;
TitlePosition = [TitleXPos TitleYPos TitleWidth TitleHeight] ;
% com_BackgroundFrame(AxesHandle, Frame1Position ) ;
Titlehandle = uicontrol(FigureHandle,'style','text', 'unit','pixels',...
'position',TitlePosition,'horizontal','center',...
'string', 'T型自卸汽車初始參數(shù)的建立', 'fontsize',18 );
% define the first frame .
FrameXPos = TabSpace * 2 ;
FrameWidth = (FigureWidth - TabSpace * 6) * 0.5 ;
FrameHeight = 395 ;
FrameYPos = TitlePosition(2) - FrameHeight - TabSpace * 2 ;
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 = 250 ;
TextPosition = [TextXPos TextYPos TextWidth TextHeight] ;
% subtitle: 輸入初始狀態(tài)(0度)時的參數(shù)
SubtitleHandle = uicontrol(FigureHandle, 'Style','text', 'Units','pixels',...
'position',TextPosition,'Horizontal','center',...
'string', '輸入初始狀態(tài)(0度)時的參數(shù)', 'fontsize',13 );
TextXPos = 130*(1:2) -80;
TextYPos = 120+35*(1:6) + TabSpace+30 +30 ;
TextWidth = 25;
Text1 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) TextYPos(1) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X1', 'fontsize',11 );
Text2 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) TextYPos(2) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X2', 'fontsize',11 );
Text3 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) TextYPos(3) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X3', 'fontsize',11 );
Text4 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) TextYPos(4) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X4', 'fontsize',11 );
Text5 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) TextYPos(5) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X5', 'fontsize',11 );
Text6 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) TextYPos(6) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X6', 'fontsize',11 );
Text7 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(2) TextYPos(1) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X7', 'fontsize',11 );
Text8 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(2) TextYPos(2) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X8', 'fontsize',11 );
Text9 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(2) TextYPos(3) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X9', 'fontsize',11 );
Text10 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(2) TextYPos(4) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'X10', 'fontsize',11 );
Text11 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(2) TextYPos(5) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'XG', 'fontsize',11 );
Text12 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(2) TextYPos(6) TextWidth TextHeight] ,'Horizontal','center',...
'string', 'YG', 'fontsize',11 );
Text13 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) 185 100 TextHeight] ,'Horizontal','left',...
'string', '最大舉升角度', 'fontsize',11 );
Text14 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) 155 100 TextHeight] ,'Horizontal','left',...
'string', '油缸速度', 'fontsize',11 );
Text15 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) 125 100 TextHeight] ,'Horizontal','left',...
'string', '車廂重量 G', 'fontsize',11 );
Text16 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) 95 100 TextHeight] ,'Horizontal','left',...
'string', '油缸直徑', 'fontsize',11 );
Text17 = uicontrol(FigureHandle,'style','text', 'Units','pixels',...
'position',[TextXPos(1) 65 140 TextHeight] ,'Horizontal','left',...
'string', '支撐座距底板距離', 'fontsize',11 );
TextXPos = 130*(1:2) -25;
TextYPos = 120+35*(1:6) + TabSpace + 30+30 ;
TextWidth = 25;
TextWidth=TextWidth+35;
edit1 = uicontrol(FigureHandle, 'Style', 'edit', 'Units','pixels',...
'position', [TextXPos(1) TextYPos(1) TextWidth TextHeight], 'Horizontal','center', 'BackgroundColor', [1 1 1], ...
'Tag','edit1' , ...
'String', 0, 'FontSize',11, ...
'Callback', ['CalculateStatusEquation(''edit1_Callback'',gcbo)'] ) ;
edit2 = uicontrol(FigureHandle, 'Style', 'edit', 'Units','pixels',...
'position', [TextXPos(1) TextYPos(2) TextWidth TextHeight], 'Horizontal','center', 'BackgroundColor', [1 1 1], ...
'Tag','edit2' , ...
'String', 0, 'FontSize',11, ...
'Callback', ['CalculateStatusEquation(''edit2_Callback'',gcbo)'] ) ;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -