Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

GUI HELP - I need help ASAP

2 views (last 30 days)
Madeleine
Madeleine on 13 May 2014
Closed: Walter Roberson on 13 May 2014
fig = figure()
iIndex =1;
array1 = [0, 25, 50, 100, 200, 400, 800, 1600, 3200];
button1= uicontrol('position',[300 150 60 60],'style', 'pushbutton', 'string','button_name','Callback',@display_button1_value);
textbox1 = uicontrol('position',[400 150 60 60],'style', 'text');
set(textbox1, 'string', array1(iIndex));
hpopup = uicontrol('Style','popupmenu','String',{'Var1','Var2','Var3'},'Position',[100,150,60,20],'Callback',@Select_Variable);
set(hpopup, 'callback', {@display_button1_value});
function display_button1_value(hObject,eventdata)
array1(iIndex) = array1(iIndex) + 1;
set(textbox1,'string', array1(iIndex))
end
So that's my code so far. Basically I want the number in the textbox to increase by 1 position in the array1 every time I click the button1. So when I run the program (without touching any button) the first number 0 will be displayed in the text box. The first time I click the button the number should change to 25. The second time I click the button it should be 50 and so on until it reaches 3200 and it can go no more. So if that made sense to anyone can you please help me. I haven't attatched my callback "select_variable" yet, but if you want it please ask :)

Answers (0)

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!