hulibo 发表于 2007-6-6 12:05

GUI界面出错的问题

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=;
%the contruction of user interface
a = figure('Units','points', ...
'Color',, ...
'Colormap',mat0, ...
'PointerShapeCData',mat1, ...
'Position',, ...
'Tag','Fig1');
axeup = axes('Parent',a, ...
'CameraUpVector',, ...
'CameraUpVectorMode','manual', ...
'Color',, ...
'ColorOrder',mat2, ...
'Position',, ...
'Tag','Axes1', ...
'XColor',, ...
'YColor',, ...
   'ZColor',);
c = text('Parent',axeup, ...
'Color',, ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
   'Position',, ...
   'String','Time(s)',...
'Tag','Axes1Text4', ...
'VerticalAlignment','cap');
set(get(c,'Parent'),'XLabel',c);
c = text('Parent',axeup, ...
'Color',, ...
'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',, ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
   'Position',, ...
   'Tag','Axes1Text1', ...
'VerticalAlignment','bottom');
set(get(c,'Parent'),'Title',c);
axedown = axes('Parent',a, ...
   'CameraUpVector',, ...
'CameraUpVectorMode','manual', ...
'Color',, ...
'ColorOrder',mat3, ...
'Position',, ...
'Tag','Axes2', ...
'XColor',, ...
'YColor',, ...
'ZColor',);
c = text('Parent',axedown, ...
'Color',, ...
'HandleVisibility','callback', ...
'HorizontalAlignment','center', ...
   'Position',, ...
   'String','Frequency(Hz)',...
'Tag','Axes2Text4', ...
'VerticalAlignment','cap');
set(get(c,'Parent'),'XLabel',c);
c = text('Parent',axedown, ...
'Color',, ...
'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',, ...
'Position',, ...
'String','Width(mm)', ...
'Style','text', ...
'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','NFreq1(Hz)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','DRatio1', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','M1(KG)', ...
'Style','text', ...
'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','FRate(mm)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','Sped(rpm)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','NFreq2(Hz)', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','DRatio2', ...
'Style','text', ...
   'Tag','StaticText1');
b = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','M2(KG)', ...
'Style','text', ...
   'Tag','StaticText1');


%the editbox of input of parameters
width = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','0.1', ...
'Style','edit', ...
'Tag','EditText1');
nfreq2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','400', ...
'Style','edit', ...
   'Tag','EditText1');
dratio1 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','0.05', ...
'Style','edit', ...
   'Tag','EditText1');
m1 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','250', ...
'Style','edit', ...
   'Tag','EditText1');
frate = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','250', ...
'Style','edit', ...
   'Tag','EditText1');
sped = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
nfreq2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
dratio2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
m2 = uicontrol('Parent',a, ...
'Units','points', ...
'BackgroundColor',, ...
'Position',, ...
'String','0', ...
'Style','edit', ...
   'Tag','EditText1');
%the buttondown definition
b = uicontrol('Parent',a, ...
   'Units','points', ...
   'BackgroundColor',, ...
'Callback',CallBackStr2, ...
'Position',, ...
'String','Simulate', ...
   'Tag','Pushbutton1');
end




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

[ 本帖最后由 eight 于 2007-6-6 12:50 编辑 ]

spano 发表于 2007-6-6 12:28

就一个标点的问题,可以看提示的行数,然后debug解决掉

eight 发表于 2007-6-6 12:52

原帖由 spano 于 2007-6-6 12:28 发表 http://www.chinavib.com/forum/images/common/back.gif
就一个标点的问题,可以看提示的行数,然后debug解决掉

正解。建议楼主自己解决

ps:其实安装 2006a (或以上)版本的 matlab 就一目了然了

hulibo 发表于 2007-6-6 12:55

根本就没提示在哪一行啊,我就郁闷了,我用的6.5,我估计是回调函数部分有错,但看了好久,看不出来哪里漏东西了,所以请大家帮忙看看,有时候自己的错误半天都发现不了,很 正常的!

eight 发表于 2007-6-6 15:30

原帖由 hulibo 于 2007-6-6 12:55 发表 http://www.chinavib.com/forum/images/common/back.gif
根本就没提示在哪一行啊,我就郁闷了,我用的6.5,我估计是回调函数部分有错,但看了好久,看不出来哪里漏东西了,所以请大家帮忙看看,有时候自己的错误半天都发现不了,很 正常的!


大哥,你那里有一个 load chasim,数据文件不提供,别人根本不能帮你测试,还是老老实实自己调试一下吧
页: [1]
查看完整版本: GUI界面出错的问题