Bakeoff_Task21.m bad behavior

Discussion in 'HAPTIX' started by David Kluger, Apr 11, 2016.

  1. This is probably another one of Matlab's version-specific problems where the script works in R2015b but not in some other versions. Whatever the case, Bakeoff_Task21.m does not run properly using the script that was released on 4/7 using Matlab versions R2014a and earlier. Very simple fix:

    Line 228: change 'SelectionChangedFcn' to 'SelectionChangeFcn'
     
  2. We encountered another bug. See the attached image.

    When we try to select a position on the hand , we get errors and the task shuts down. I traced this bug to the "evt" struct never being created and being mishandled by the SelectPosition subfunction.

    A quick, but possibly improper, fix is to replace line 461:
    Code:
    p = evt.IntersectionPoint;
    with:
    Code:
    [p(1), p(2)] = ginput(1);
    This illuminates the "Confirm" button, allows trials to continue, and does not cause Matlab to crash. However, once you select a position in the GUI, you cannot change the position if you made a mistake.
     

    Attached Files:

  3. Emo Todorov

    Emo Todorov Administrator Staff Member

    Re SelectionChangeFcn, the MATLAB documentation says:

    Note: The name of this property changed from SelectionChangeFcn to SelectionChangedFcn in R2014b.

    I added code to check the MATLAB version number and use the proper callback name. Curiously, your fix works in 2016a even though the old name is no longer supported... apparently they keep old property names for a while, but we should not rely on this.


    Re evt.IntersectPoint, the MATLAB documentation says:
    • Event data — This argument is empty for this property. Replace it with the tilde character (~) in the function definition to indicate that this argument is not used.
    In other words, evt was supposed to be empty all along... so why does my code work in the newer MATLAB versions? Go figure. Anyway, I replaced this with get(gca,'CurrentPoint') which returns numbers that are not identical but are within one pixel.

    The updated Bakeoff_Task21.m is attached here. I will also ask DEKA to upload it on their server.

    Thanks for debugging.
     

    Attached Files: