How to force a matlab script to rerun the script from the beginning using list items and if statement? I have the following code: % Here is the Main Code that does stuff % After the code has done some stuff the user is left with three options: list = {'text1','text2','RERUN_SCRIPT'}; [indx] = listdlg('SelectionMode','single','ListString',list); % with the following if statements if indx == 1 % code for importing works end if indx == 2 % code for deleting unwanted external files work end if indx == 3 % I cannot find a direct method to start the script again. end Also there is one problem: While my list is active I cannot edit my figure in the main code. Is there an option, even by default, allow an active edit of figures, etc. while list is active?
Kshitij Singh answered .
2025-11-20
indx == 3
while indx == 3
% After the code has done some stuff the user is left with three options:
list = {'text1','text2','RERUN_SCRIPT'};
[indx] = listdlg('SelectionMode','single','ListString',list);
% Use a switch statement. The loop will continue execution as long as the user selects 'rerun'
switch indx
case 1
% code for importing works
case 2
% code for deleting unwanted external files work
end
end