"I was having problems where only the invalid selection was being made"
That's because, in the words of the uicontrol properties documentation, "Value property equals an array index corresponding to the selected item in the pop-up menu. A value of 1 corresponds to the first item in the pop-up menu."
This means that your switch/case should look something like this:
selectedOption = get(dropdown, 'Value');
switch selectedOption
case 1 % '0 minutes'
volume = TotalVolume;
case 2 % '10 minutes'
volume = 1.25 * TotalVolume;
case 3 % '20 minutes'
volume = 2.93 * TotalVolume;
case 4 % '30 minutes'
volume = 3.14 * TotalVolume;
case 5 % '40+ minutes'
volume = 4 * TotalVolume;
otherwise
error('Invalid selection');
end
(The way you had it would've been appropriate for a uidropdown object, which is a different type of object from a popupmenu-style uicontrol. See, for reference: https://www.mathworks.com/help/matlab/ref/matlab.ui.control.dropdown-properties.html)
Of course, now the problem is that the variable TotalVolume is undefined. I don't know where that's supposed to come from.
"now the dropdown menu doesn't even come up"
That happens if the popupmenu Value is invalid, e.g., because it's outside the range of the String or not an integer. In this situation, unless you've turned off warning(s), you'll see the following in the command window:
Warning: 'popupmenu' control requires that 'Value' be an integer within
Character vector range
Control will not be rendered until all of its parameter values are valid
I don't see anything in the code you've shared that would cause that though.