Bakeoff_Task31.m bad behavior

Discussion in 'HAPTIX' started by David Kluger, Mar 9, 2016.

  1. The confirm button does not enable after the hardness/size is chosen in the UI. We cannot progress through this task because we cannot go forward in trial number. When we first run the .m file, we get 9x warnings in MATLAB:

    Code:
    Warning: Callback for uicontrol of style radiobutton will be overwritten when added to a UIBUTTONGROUP.
    Use the SelectionChangeFcn property on the button group instead.
    > In uitools.uibuttongroup.childAddedCbk at 12
      In Bakeoff_Task31>MakeResponse at 198
      In Bakeoff_Task31 at 20 
    MATLAB version is 2014a.

    - David
     
  2. Found the bug. Change the 'btn' definition in 'MakeResponse' to:
    Code:
    btn = uibuttongroup(panel, 'units','pixel','position',[100 20 210 120],...
                'SelectionChangeFcn','set(get(gcf,''UserData''),''enable'',''on'')');
    And change the 'sel(r,c)' definition to:
    Code:
    sel(r,c) = uicontrol(btn,'style','radiobutton',...
                        'position',[10+(c-1)*80 10+(r-1)*40 20 20],'UserData',c+3*(r-1));
    This eliminates the warnings, maintains proper "confirm" button behavior, and allows trials to progress.

    - David
     
  3. Emo Todorov

    Emo Todorov Administrator Staff Member

    My code works in MATLAB 2015b, but apparently not in 2014a. I will try your change, and assuming it also works with my version of MATLAB, will switch to it.

    EDIT: Ok, this works for me, so I made the change in the official code. DEKA will make it available in a couple of days.
     
    Last edited: Mar 11, 2016