I would like to create a warning dialog for my script with a dynamic number of inputs to list how many folders in a scenario are empty.
For example, if I have 5 folders (folderA through folderE), and three of them are empty, the script should determine which three were empty and list them in the warning dialog such that the warning dialog says:
" The following folders are empty:
I would like this to work no matter how many folders are empty. So if only two folders are empty, only two would be listed, and if all five folders are empty, all five would be listed.
I have the list of empty folders saved in a cell array.
I initially tried running the warning message through a for loop, but it overwrote the message each time and only one folder was listed at the end.
I also tried the following code:
warningmessage = sprintf('The following folders are empty:\n%s\n',char(emptyFolders));
warndlg = (warningmessage,'Warning');
The result from this code (for three empty folders) is a warning dialog with the message:
"The following folders are empty:
Is there a way to write a variable number of strings into a message?