Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
 
 
主题工具 显示模式
旧 2008-07-01, 18:44   #1
yangn2003
初级会员
 
注册日期: 2008-07-01
年龄: 41
帖子: 5
声望力: 0
yangn2003 正向着好的方向发展
默认 怎样让滑动条的数值通过公式画出图形来?

我想要运行一个横轴为se,纵轴为sa,公式为E=se/sa 的图形来,通过滑动条让用户自己确定E的值,se,sa的值自动生成,可是图形始终出不来,下面是我的代码,在sa,se和flag的设立上总是显示有错误。

function varargout = ex72(varargin)

% Edit the above text to modify the response to help ex72
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ex72_OpeningFcn, ...
'gui_OutputFcn', @ex72_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before ex72 is made visible.
function ex72_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);

% --- Outputs from this function are returned to the command line.
function varargout = ex72_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

% --- Executes on slider movement.
function ex72_E_Callback(hObject, eventdata, handles)


% --- Executes during object creation, after setting all properties.
function ex72_E_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes on button press in ex72_plot.
function ex72_plot_Callback(hObject, eventdata, handles)
flag=get(handles.ex72_E,'Value'); %get the value of the slider
sa=flag*se; 问题所在

axes(handles.ex72_axes) %claim the graph drawed on the ex71_axes
plot(se,sa)

% --- Executes on button press in ex72_close.
function ex72_close_Callback(hObject, eventdata, handles)
上传的图像
文件类型: jpg 2.JPG (21.6 KB, 6 次查看)
yangn2003 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 05:57


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.