Trying to create a drop down that will open a new uifigure, nothing happens when I click confirm?
Im writting a program to process data from different autonomous vehicles. I have 5 different vehicles that I can run and each of their data sets are recorded differently with different options, I have written a robust program that does alot of different things but only for 1 vehicle. Now im trying to expand this program but allowing the user to select the vehicle they ran and want to process. Below is what I have so far:
function [name, dd2_option] = programName()
%//////////////////////////////////////////////////////////////////////////
%////////////////////// VEHICLE SELECTION ////////////////////
%//////////////////////////////////////////////////////////////////////////
%create a small figure to show the pop up menu
fig1 = uifigure(‘Name’, ‘Drop Down Menu’, ‘Position’, [500, 500, 200, 150]);
%figure text
uilabel(fig1, …
‘Text’, ‘Select Vehicle:’, …
‘Position’, [25, 90, 120, 30], …
‘FontSize’, 14);
%drop down menu
dda = uidropdown(fig1, ‘Position’, [25, 50, 120, 30]);
dda.Items = ["Vehicle Selection", ‘USV-1’, ‘USV-2’, ‘AUGV’, ‘UUV’, ‘ROV’];
dda.ItemsData = [0, 1, 2, 3, 4, 5];
%confirm button
btna = uibutton(fig1,’Position’,[25, 10, 120, 30],’Text’,’Confirm’,’ButtonPushedFcn’,@(btn, event) confirmSelection(dda.Value));
%function to determine which dd option was selected
function confirmSelection(selectedOption)
switch selectedOption
case ‘USV-1’
usv1Figure()
case ‘USV-2’
usv2Figure()
case ‘AUGV’
augvFigure()
case ‘UUV’
uuvFigure()
case ‘ROV’
rovFigure()
end
end
function usv1Figure()
delete(fig1)
%start the program for USV1
When I run the code fig1 pops up with my drop down and I can select which option I want. Right now the only value that works is ‘USV-1’ option, when select that nothing happens. What I think it should do is close fig1 with the drop down and open fig2 to start my program. like I said, nothing happens, I dont get any warnings or errors in the command window, fig1 doesnt close, and fig2 doesnt open. Nothing happens. Where am I going wrong? Before I added this I had no issues running my program. Thanks in advance to any help you can give!Im writting a program to process data from different autonomous vehicles. I have 5 different vehicles that I can run and each of their data sets are recorded differently with different options, I have written a robust program that does alot of different things but only for 1 vehicle. Now im trying to expand this program but allowing the user to select the vehicle they ran and want to process. Below is what I have so far:
function [name, dd2_option] = programName()
%//////////////////////////////////////////////////////////////////////////
%////////////////////// VEHICLE SELECTION ////////////////////
%//////////////////////////////////////////////////////////////////////////
%create a small figure to show the pop up menu
fig1 = uifigure(‘Name’, ‘Drop Down Menu’, ‘Position’, [500, 500, 200, 150]);
%figure text
uilabel(fig1, …
‘Text’, ‘Select Vehicle:’, …
‘Position’, [25, 90, 120, 30], …
‘FontSize’, 14);
%drop down menu
dda = uidropdown(fig1, ‘Position’, [25, 50, 120, 30]);
dda.Items = ["Vehicle Selection", ‘USV-1’, ‘USV-2’, ‘AUGV’, ‘UUV’, ‘ROV’];
dda.ItemsData = [0, 1, 2, 3, 4, 5];
%confirm button
btna = uibutton(fig1,’Position’,[25, 10, 120, 30],’Text’,’Confirm’,’ButtonPushedFcn’,@(btn, event) confirmSelection(dda.Value));
%function to determine which dd option was selected
function confirmSelection(selectedOption)
switch selectedOption
case ‘USV-1’
usv1Figure()
case ‘USV-2’
usv2Figure()
case ‘AUGV’
augvFigure()
case ‘UUV’
uuvFigure()
case ‘ROV’
rovFigure()
end
end
function usv1Figure()
delete(fig1)
%start the program for USV1
When I run the code fig1 pops up with my drop down and I can select which option I want. Right now the only value that works is ‘USV-1’ option, when select that nothing happens. What I think it should do is close fig1 with the drop down and open fig2 to start my program. like I said, nothing happens, I dont get any warnings or errors in the command window, fig1 doesnt close, and fig2 doesnt open. Nothing happens. Where am I going wrong? Before I added this I had no issues running my program. Thanks in advance to any help you can give! Im writting a program to process data from different autonomous vehicles. I have 5 different vehicles that I can run and each of their data sets are recorded differently with different options, I have written a robust program that does alot of different things but only for 1 vehicle. Now im trying to expand this program but allowing the user to select the vehicle they ran and want to process. Below is what I have so far:
function [name, dd2_option] = programName()
%//////////////////////////////////////////////////////////////////////////
%////////////////////// VEHICLE SELECTION ////////////////////
%//////////////////////////////////////////////////////////////////////////
%create a small figure to show the pop up menu
fig1 = uifigure(‘Name’, ‘Drop Down Menu’, ‘Position’, [500, 500, 200, 150]);
%figure text
uilabel(fig1, …
‘Text’, ‘Select Vehicle:’, …
‘Position’, [25, 90, 120, 30], …
‘FontSize’, 14);
%drop down menu
dda = uidropdown(fig1, ‘Position’, [25, 50, 120, 30]);
dda.Items = ["Vehicle Selection", ‘USV-1’, ‘USV-2’, ‘AUGV’, ‘UUV’, ‘ROV’];
dda.ItemsData = [0, 1, 2, 3, 4, 5];
%confirm button
btna = uibutton(fig1,’Position’,[25, 10, 120, 30],’Text’,’Confirm’,’ButtonPushedFcn’,@(btn, event) confirmSelection(dda.Value));
%function to determine which dd option was selected
function confirmSelection(selectedOption)
switch selectedOption
case ‘USV-1’
usv1Figure()
case ‘USV-2’
usv2Figure()
case ‘AUGV’
augvFigure()
case ‘UUV’
uuvFigure()
case ‘ROV’
rovFigure()
end
end
function usv1Figure()
delete(fig1)
%start the program for USV1
When I run the code fig1 pops up with my drop down and I can select which option I want. Right now the only value that works is ‘USV-1’ option, when select that nothing happens. What I think it should do is close fig1 with the drop down and open fig2 to start my program. like I said, nothing happens, I dont get any warnings or errors in the command window, fig1 doesnt close, and fig2 doesnt open. Nothing happens. Where am I going wrong? Before I added this I had no issues running my program. Thanks in advance to any help you can give! uifigure MATLAB Answers — New Questions