声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2215|回复: 4

[GUI界面] GUI界面出错的问题

[复制链接]
发表于 2007-6-6 12:05 | 显示全部楼层 |阅读模式

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

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

x
function chasim()
% This is the machine-generated representation of a Handle Graphics object
% and its children.  Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object was saved.
%
% To reopen this object, just type the name of the M-file at the MATLAB
% prompt. The M-file and its associated MAT-file must be on your path.

global Tin
global CW
global RPM
global M1
global M2
global FRATE
global FN1
global FN2
global DRATIO1
global DRATIO2
load chasim
step=0.0002; %sampling circle
Tin=0:step:2;
Tin=Tin';
%the callback funtion definiton of simulate buttondown
Str1='Sped = str2num(get(sped,''string''));RPM=Sped*ones(size(Tin));';
Str2='Bw = str2num(get(width,''string'')); CW=Bw*ones(size(Tin));';
Str3='DRatio1 = str2num(get(dratio1,''string''));DRATIO1=Dratio1*ones(size(Tin));';
Str4='NFreq1 = str2num(get(nfreq1,''string''));FN1=NFreq1*ones(size(Tin));';
Str5='NFreq2 = str2num(get(nfreq2,''string''));FN2=NFreq2*ones(size(Tin));';
Str6='DRatio2 = str2num(get(dratio2,''string''));DRATIO2=Dratio2*ones(size(Tin))';
Str7='M11 = str2num(get(m1,''string''));M1=M11*ones(size(Tin));';
Str8='M22= str2num(get(m2,''string''));M2=M22*ones(size(Tin));';
Str9='Frate = str2num(get(frate,''string''));FRATE=Frate*ones(size(Tin));';
Str10='sim(''basic1'');';
Str11='axes(axeup); plot(Tin,y);';
CallBackStr2=[Str1 Str2 Str3 Str4 Str5 Str6 Str7 Str8 Str9 Str10 Str11];
%the contruction of user interface
a = figure('Units','points', ...
'Color',[0.8 0.8 0.8], ...
'Colormap',mat0, ...
'PointerShapeCData',mat1, ...
'Position',[80 50 426.75 338.25], ...
'Tag','Fig1');
axeup = axes('Parent',a, ...
'CameraUpVector',[0 1 0], ...
'CameraUpVectorMode','manual', ...
'Color',[1 1 1], ...
'ColorOrder',mat2, ...
'Position',[0.056239 0.586297 0.934974 0.370288], ...
'Tag','Axes1', ...
'XColor',[0 0 0], ...
'YColor',[0 0 0], ...
   'ZColor',[0 0 0]);
c = text('Parent',axeup, ...
'Color',[0 0 0], ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
   'Position',[0.499058 -0.167832 0], ...
   'String','Time(s)',...
'Tag','Axes1Text4', ...
'VerticalAlignment','cap');
set(get(c,'Parent'),'XLabel',c);
c = text('Parent',axeup, ...
'Color',[0 0 0], ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
'Position',[-0.0546139 0.48951 0], ...
   'Rotation',90, ...
   'String','Displacement(mm)',...
'Tag','Axes1Text3', ...
'VerticalAlignment','baseline');
set(get(c,'Parent'),'YLabel',c);
c = text('Parent',axeup, ...
'Color',[0 0 0], ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
   'Position',[0.499058 0.8595 0], ...
   'Tag','Axes1Text1', ...
'VerticalAlignment','bottom');
set(get(c,'Parent'),'Title',c);
axedown = axes('Parent',a, ...
   'CameraUpVector',[0 1 0], ...
'CameraUpVectorMode','manual', ...
'Color',[1 1 1], ...
'ColorOrder',mat3, ...
'Position',[0.056239 0.166297 0.934974 0.370288], ...
'Tag','Axes2', ...
'XColor',[0 0 0], ...
'YColor',[0 0 0], ...
'ZColor',[0 0 0]);
c = text('Parent',axedown, ...
'Color',[0 0 0], ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
   'Position',[0.499058 -0.144578 0], ...
   'String','Frequency(Hz)',...
'Tag','Axes2Text4', ...
'VerticalAlignment','cap');
set(get(c,'Parent'),'XLabel',c);
c = text('Parent',axedown, ...
'Color',[0 0 0], ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
'Position',[-0.0546139 0.493976 0], ...
   'Rotation',90, ...
   'String','Spectrum',...
'Tag','Axes2Text3', ...
'VerticalAlignment','baseline');
set(get(c,'Parent'),'YLabel',c);
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[70 25 45 12], ...
'String','Width(mm)', ...
'Style','text', ...
'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[155 25 45 12], ...
'String','NFreq1(Hz)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[240 25 45 12], ...
'String','DRatio1', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[325 25 45 12], ...
'String','M1(KG)', ...
'Style','text', ...
'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[418 25 45 12], ...
'String','FRate(mm)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[70 5 45 12], ...
'String','Sped(rpm)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[155 5 45 12], ...
'String','NFreq2(Hz)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[240 5 45 12], ...
'String','DRatio2', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'Position',[325 5 45 12], ...
'String','M2(KG)', ...
'Style','text', ...
   'Tag','StaticText1');


%the editbox of input of parameters
width = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[115 25 35 15], ...
'String','0.1', ...
'Style','edit', ...
'Tag','EditText1');
nfreq2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[200 25 35 15], ...
'String','400', ...
'Style','edit', ...
   'Tag','EditText1');
dratio1 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[285 25 35 15], ...
'String','0.05', ...
'Style','edit', ...
   'Tag','EditText1');
m1 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[375 25 35 15], ...
'String','250', ...
'Style','edit', ...
   'Tag','EditText1');
frate = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[465 25 35 15], ...
'String','250', ...
'Style','edit', ...
   'Tag','EditText1');
sped = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[115 5 35 15], ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
nfreq2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[200 5 35 15], ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
dratio2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[285 5 35 15], ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
m2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'Position',[375 5 35 15], ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
%the buttondown definition
b = uicontrol('Parent',a, ...
   'Units','points', ...
   'BackgroundColor',[1 0.1 0.5], ...
'Callback',CallBackStr2, ...
'Position',[19.5 5 45 35], ...
'String','Simulate', ...
   'Tag','Pushbutton1');
end




运行后出现??? Error: Missing operator, comma, or semicolon.
??? Error while evaluating uicontrol Callback.
两个错误,我对GUI还不熟悉,大致可以看懂,但是里面有没有其他规定我还了解的不全面,麻烦高手帮哦我看看,哪里出了问题,谢谢大家!如若需要其他的的链接的程序,我的QQ113707213,恳请大家给我看看,急啊!

[ 本帖最后由 eight 于 2007-6-6 12:50 编辑 ]
回复
分享到:

使用道具 举报

发表于 2007-6-6 12:28 | 显示全部楼层
就一个标点的问题,可以看提示的行数,然后  debug解决掉
发表于 2007-6-6 12:52 | 显示全部楼层


正解。建议楼主自己解决

ps:其实安装 2006a (或以上)版本的 matlab 就一目了然了
 楼主| 发表于 2007-6-6 12:55 | 显示全部楼层
根本就没提示在哪一行啊,我就郁闷了,我用的6.5,我估计是回调函数部分有错,但看了好久,看不出来哪里漏东西了,所以请大家帮忙看看,有时候自己的错误半天都发现不了,很 正常的!
发表于 2007-6-6 15:30 | 显示全部楼层
原帖由 hulibo 于 2007-6-6 12:55 发表
根本就没提示在哪一行啊,我就郁闷了,我用的6.5,我估计是回调函数部分有错,但看了好久,看不出来哪里漏东西了,所以请大家帮忙看看,有时候自己的错误半天都发现不了,很 正常的!



大哥,你那里有一个 load chasim,数据文件不提供,别人根本不能帮你测试,还是老老实实自己调试一下吧
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-11-25 00:59 , Processed in 0.087477 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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