非模式questdlg.m提示 [英] Non-modal questdlg.m prompt

查看:130
本文介绍了非模式questdlg.m提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码绘制了一个图,然后提示用户询问他是否要绘制另一个具有不同参数的图.问题是,当questdlg.m打开时,用户无法查看情节上的细节.

My code makes a plot and then makes a prompt asking the user if he wants to make another plot with different parameters. The problem is, while questdlg.m is open, the user cannot look at details on the plot.

这是代码:

while strcmp(Cont,'Yes') == 1

    %Some code modifying 'data'

    plot(1:X,data);
    Cont = questdlg('Would you like to plot another pixel?','','Yes','No','Yes');
    close all;

end

我尝试了一些事情.我试图创建另一个名为normalquestdlg.m的函数,然后将粘贴的questdlg.m代码复制到其中,修改了第401行.

I've tried a few things. I tried to create another function called normalquestdlg.m, and I copy pasted the questdlg.m code into it, modifying line 401.

set(QuestFig,'WindowStyle','modal','Visible','on');

set(QuestFig,'Visible','on');

我为normalquestdlg.m函数尝试了其他位置.将其放在我的默认Matlab文件夹中以获取自制函数会给我以下错误:

I tried different location for the normalquestdlg.m function. Putting it in my default Matlab folder for homemade functions gave me the following error :

Undefined function 'dialogCellstrHelper' for input arguments of type 'char'.

Error in **normalquestdlg** (line 74)
    Question = dialogCellstrHelper(Question);

Error in **Plot** (line 40)
    Cont = normalquestdlg('Would you like to plot another pixel?','','Yes','No','Yes');

并将其放在与questdlg.m相同的文件夹中(C:\ Program Files \ MATLAB \ R2014a \ toolbox \ matlab \ uitools)给了我以下错误:

And putting it in the same folder as questdlg.m (C:\Program Files\MATLAB\R2014a\toolbox\matlab\uitools) gave me the following error :

Undefined function 'normalquestdlg' for input arguments of type 'char'.

Error in **Plot** (line 40)
    Cont = normalquestdlg('Would you like to plot another pixel?','','Yes','No','Yes');

我什至试图把它作为寻找的第一条路径:

I even tried to put it as the first path to look for :

p = path
path('C:\Program Files\MATLAB\R2014a\toolbox\matlab\uitools', p)
Cont = normalquestdlg('Would you like to plot another pixel?','','Yes','No','Yes');
path(p)

不用说,这并没有改变任何事情.

Needless to say, this didn't change a thing.

有人对我有什么提示吗?

Anyone has any tips for me?

推荐答案

找不到简单的解决方案.我能找到的最简单的方法是下载MFquestdlg.m(

No easy solutions were to be found. The easiest thing I could find was to download MFquestdlg.m (http://www.mathworks.com/matlabcentral/fileexchange/31044-specifying-questdlg-position/content/MFquestdlg.m) and modify line 384 of it this way :

set(QuestFig, 'WindowStyle', 'modal', 'Visible', 'on');

set(QuestFig, 'Visible', 'on');

因为正常"是默认的WindowStyle.

since 'normal' is the default WindowStyle.

与修改Matlab基本功能相比,我更喜欢这样做.通过在指定WindowStyle的函数中添加输入(正常",模态"或停靠"),可以进一步增强此功能(如果有人需要这样做),并且添加起来也很容易.像这种样式的防故障线:

I prefered to do this than to modify basic Matlab functions. This could be enhanced even more (if someone had the need to do so) by adding an input in the function specifying the WindowStyle (either 'normal', 'modal' or 'docked'), and it would be quite easy, adding too a little fail-proof like line in this style :

if nargin < 8
    WinStyle = '%enter default mode'
end
if nargin == 8
    if strcmp(WinStyle,'normal') == 1 | strcmp(WinStyle, 'modal') == 1 | strcmp(WinStyle, 'docked') == 1
    else
        error('MATLAB:questdlg:IncorrectInput', 'The WindowStyle input parameter was incorrectly written')
    end
end

这篇关于非模式questdlg.m提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆