声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1137|回复: 2

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

[复制链接]
发表于 2006-5-12 21:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
function  varargout = myfit( varargin )<BR>    % clf reset<BR>    FigureHandle = figure( 'Visible', 'on' ) ;<BR>    set( FigureHandle, 'Units' , 'normalized', 'Position', [0.2 0.2 0.75 0.6], ...<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>function  generate_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',[0.70 0.23 0.10 0.08], 'string','grid on',...<BR>    'Fontsize',12,'callback','grid on');<BR><BR>    h_push1 = uicontrol(FigureHandle,'style','push','unit','normalized', ...<BR>    'position',[0.70 0.15 0.10 0.08], 'string','grid off',...<BR>    'Fontsize',12,'callback','grid off');<BR><BR><BR>% --------------------------------------------------------------------------<BR>function  MenuOpenHistory_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>        [TempPathName, FileName, FileTypeName, Version] = fileparts( FileName ) ;<BR><BR>        if ~strcmp( FileTypeName, '.mat' ) ;<BR>            warndlg( WarningString1, '警告', 'modal' ) ;<BR>            return ;<BR>        end<BR>        SaveFile = fullfile( PathName, [FileName, FileTypeName, Version] ) ;<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 ) ;
回复
分享到:

使用道具 举报

 楼主| 发表于 2006-5-12 21:54 | 显示全部楼层

re

open调用出错
发表于 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>
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-25 17:15 , Processed in 0.073435 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表