Search code examples
matlabuser-interfacematlab-guidematlab-uitable

Matlab uitable data selection


I have Uitable with data read from a AScii file.

  1. I want to select columns using mouse and also using checkboxes. I tried a lot but i cannot figure out how to select uitable column using mouse and getting that data.

  2. Also I am trying to insert checkbox in the last row of the uitable, so when user selects checkbox, particular column is selected.

Any idea?


Solution

  • You should edit the CellSelectionCallback and the CellEditCallback properties of your table.

       set(myTable,`CellSelectionCallback`,@CallBack)
    

    In order to see what columns/rows were selected, use the event data that you receive in your callback.

      function CallBack(hObj,evt)   
          disp(evt);
      end
    

    As far as I know, there is no way to discover what columns are currently selected when the callback is not fired.