matlab中的字段编辑
我用以下代码在MATLAB中创建消息框matlab中的字段编辑,matlab,Matlab,我用以下代码在MATLAB中创建消息框 prompt={'Length'} name = 'Input'; answer = inputdlg(prompt,name,[1 40],defaultans); Length = str2double(answer{1}); choice = questdlg('Would you like to confirm?', ... 'Message Box', ... 'Yes','No','No'); switch choice
prompt={'Length'}
name = 'Input';
answer = inputdlg(prompt,name,[1 40],defaultans);
Length = str2double(answer{1});
choice = questdlg('Would you like to confirm?', ...
'Message Box', ...
'Yes','No','No');
switch choice
case 'Yes'
h = msgbox({'Operation' 'Completed'});
case 'No'
h = msgbox({'Operation' 'Failed'});
end
我正在输入如下图所示的值
移动到下一个窗口后,当我按“否”时,我希望显示与上面所示相同的早期输入窗口,输入框中写入120,以便我可以更改值
任何人都可以让我知道如何切换到上一个窗口,我可以编辑我的价值观,已经写了 使用无限循环并将语句放入其中。当用户确认后,它将被删除
修改代码:
prompt={'Length'};
name = 'Input';
defaultans={'120'};
while 1
answer = inputdlg(prompt,name,[1 40],defaultans);
choice = questdlg('Would you like to confirm?', ...
'Message Box', ...
'Yes','No','No');
switch choice
case 'Yes'
h = msgbox({'Operation' 'Completed'});
Length = str2double(answer{1});
break;
end
end