Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 如何操作按钮位置属性?_Matlab_Button - Fatal编程技术网

Matlab 如何操作按钮位置属性?

Matlab 如何操作按钮位置属性?,matlab,button,Matlab,Button,我正在努力调整按钮的位置。应该没那么难,但不知怎的我想不出来。你知道在哪里添加正确的代码吗 button = 'Continue'; while strcmpi(button, 'Continue') promptMessage = sprintf('Are the results ok?,\nor should the script be stopped?'); titleBarCaption = 'Continue?'; button.Position = [100 10

我正在努力调整按钮的位置。应该没那么难,但不知怎的我想不出来。你知道在哪里添加正确的代码吗

button = 'Continue';

while strcmpi(button, 'Continue')

promptMessage = sprintf('Are the results ok?,\nor should the script be stopped?');
    titleBarCaption = 'Continue?';
    button.Position = [100 100 50 20];                    %this line seems to the issue
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');

if strcmpi(button, 'Cancel')
break;
end
end

下面是一个示例,在
questdlg
提示符下按continue键时,在
ui图中随机放置
ui按钮。这里,
ui按钮
被命名为
Test\u按钮
,它独立于字符向量
按钮
。由于问题中的详细信息有限,我不确定您是否试图更改
questdlg
提示符中按钮的位置

UI_Figure = uifigure;
UI_Figure.Position = [0 0 500 500];
Test_Button = uibutton('Parent',UI_Figure);

Figure_Width = UI_Figure.Position(3);
Figure_Height = UI_Figure.Position(4);

button = 'Continue';

while strcmpi(button, 'Continue')

promptMessage = sprintf('Are the results ok?,\nor should the script be stopped?');

titleBarCaption = 'Continue?';
Test_Button.Position = [round(rand(1)*Figure_Width) round(rand(1)*Figure_Height) 50 20];                    

%this line seems to the issue
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');

if strcmpi(button, 'Cancel')
break;
end

end

button.Position=…
尝试调整
按钮的位置,但此时
按钮是一个字符向量(在第一行中定义),因此出现错误请询问特定的编程问题。“询问有关堆栈溢出的问题应该是找到答案过程中的最后一步”非常感谢。这对我有帮助。