msirong 发表于 2006-5-12 21:53

[求助][讨论]请高手们给我看看这个程序

functionvarargout = myfit( varargin )<BR>    % clf reset<BR>    FigureHandle = figure( 'Visible', 'on' ) ;<BR>    set( FigureHandle, 'Units' , 'normalized', 'Position', , ...<BR>      'Name', 'Curve Fitting Program', ...<BR>      'Tag', 'T_youhua', ...<BR>      'FileName' , '' ,...<BR>      'MenuBar' , 'none' ,...<BR>      'NumberTitle' , 'off' ,...<BR>      'Resize', 'off', ...<BR>      'windowstyle', 'normal') ; <BR>   <BR>    generate_MenuContent( FigureHandle ) ;<BR>    generate_FigureContent( FigureHandle ) ;<BR>    set( FigureHandle, 'Visible', 'on' ) ;   <BR>    <BR>    % ------------------------------------------------------------<BR><BR>functiongenerate_MenuContent( FigureHandle ) ;<BR><BR>% generate the file menu .<BR>% ------------------------------------------------------------<BR>MenuHandle = uimenu( 'Parent', FigureHandle, 'Label', 'File (&amp;F)' ) ;<BR><BR>% define the parameters of the menus .<BR>MenuLabel = { 'Open (&amp;O)'; 'Exit (&amp;E)' } ;<BR><BR>% add Polygon <BR>MenuTag = { 'MenuOpenHistory'; 'MenuClose' } ;<BR>MenuCallback = { ...<BR>    ['myfit( ''MenuOpenHistory_Callback11'', gcbf)']; ...<BR>    ['close all;'] } ;<BR>SeparatorGroup = { 'off'; 'on' } ;<BR><BR>% generate the uimenus of file .<BR>for num = 1: length( MenuTag )<BR>% for num = 2<BR>    UimenuHandle(num) = uimenu( MenuHandle ) ;<BR>    set( UimenuHandle(num), 'Tag' , MenuTag{num} , ...<BR>      'Callback' , MenuCallback{num} , ...<BR>      'Label' , MenuLabel{num} , ...<BR>      'Separator', SeparatorGroup{num} ) ;<BR>end<BR><BR>% ---------------------------------------------------<BR>function generate_FigureContent( FigureHandle ) ;<BR><BR>    h_push1 = uicontrol(FigureHandle,'style','push','unit','normalized', ...<BR>    'position',, 'string','grid on',...<BR>    'Fontsize',12,'callback','grid on');<BR><BR>    h_push1 = uicontrol(FigureHandle,'style','push','unit','normalized', ...<BR>    'position',, 'string','grid off',...<BR>    'Fontsize',12,'callback','grid off');<BR><BR><BR>% --------------------------------------------------------------------------<BR>functionMenuOpenHistory_Callback( h )<BR>       <BR>    handles = guidata( h ) ;<BR><BR>    PromptString = '选择数据文件.' ;<BR>    WarningString1 = '文件格式出错。 ' ;<BR>    WarningString2 = '选择的文件不是正确的数据文件。 ' ;<BR><BR>    [ FileName , PathName ] = uigetfile( {'*.mat','数据文件(*.mat)'}, PromptString ) ;<BR><BR><BR>    if FileName == 0<BR>      return ;    <BR>    else<BR>    <BR>       = fileparts( FileName ) ;<BR><BR>      if ~strcmp( FileTypeName, '.mat' ) ;<BR>            warndlg( WarningString1, '警告', 'modal' ) ;<BR>            return ;<BR>      end<BR>      SaveFile = fullfile( PathName, ) ;<BR>    end<BR><BR>    T_SimulationData = [] ;<BR>    try<BR>      load( SaveFile, 'T_SimulationData' ) ;<BR>    catch<BR>    end<BR><BR>    if isempty( T_SimulationData ) | ~isstruct( T_SimulationData );<BR><BR>    <BR>      warndlg( WarningString1, '警告', 'modal' ) ;<BR>    return ;<BR>end<BR><BR><BR>% save the data .<BR>setappdata( handles.myfit, 'T_SimulationData', T_SimulationData ) ;

msirong 发表于 2006-5-12 21:54

re

open调用出错

happy 发表于 2006-5-13 17:09

回复:(msirong)re

<DIV class=quote><B>以下是引用<I>msirong</I>在2006-5-12 21:54:03的发言:</B><BR>open调用出错</DIV>
<P>MenuCallback = { ...<BR>    ['myfit( ''MenuOpenHistory_Callback11'',uigetfile)']; ...<BR>    ['close all;'] } ;<BR><BR>关于uigetfile怎么用可以看帮助,也可以看看前面的帖子,讨论过这个问题</P>
页: [1]
查看完整版本: [求助][讨论]请高手们给我看看这个程序