MATLAB弹出对话框的使用

来源:互联网 发布:淘宝网招聘官网 编辑:程序博客网 时间:2024/05/01 06:53

Matlab 弹出对话框使用

msgbox('你要显示的内容', '对话框标题');

msgbox(num2str(p), '对话框标题');

matlab中inputdlg函数用户交互中使用方法如下:

answer = inputdlg(prompt,dlg_title,num_lines,defAns,options)

prompt:输入文本框的标签

dlg_title:对话框的标题

num_lines:输入文本框的行数

defAns:默认的文本框内容

options:一些可选的对话框选项

prompt={'Enter the matrix size for x^2:',...
'Enter the colormap name:'};
name='Input for Peaks function';
numlines=1;
defaultanswer={'20','hsv'};

options.Resize='on';
options.WindowStyle='normal';
options.Interpreter='tex';

answer=inputdlg(prompt,name,numlines,defaultanswer,options);

返回为字符串,如果想转化为数字,可以是使用函数eval。

另外input函数也可以实现用户信息输入,不过是在命令行中输入,也很简单、常用。

1 0