我编写了下面的程序,以便从用户那里得到一个字符串数组,然后对它们进行排序,然后向用户显示排序后的数组。排序杀死程序:MATLAB
但似乎sort
函数完全杀死程序。因为第二个msgbox
从不出现。
另请注意,如果我在第一次取消inputdlg
时出现两个消息框。
strings = {};
count = 1;
while(1)
prompt = {strcat('Enter the ', num2str(count), '# String')};
temp = inputdlg(prompt,'Input String',1,{'String'});
if isempty(temp)
break
end
strings{count} = temp;
count = count + 1;
end
msgbox('Processing....');
sorted = sort(strings); % The program stops executing on this point
msgbox('Operation Completed');
那么为什么程序永远不会执行最后一行?谢谢。
你的问题是什么?此外,你应该提供一个完整的可执行示例(即[mcve](http://stackoverflow.com/help/mcve)) – kkuilla
我认为“排序”功能杀死了程序,但我希望它继续工作。换句话说:“为什么第二个msgbox从不显示?”编辑:这是一个可执行的例子,当我在编辑器中运行它时工作正常(除了我提到的问题) – AliLotfi
用该语句更新您的问题。 – kkuilla