0

I am trying to sort a matlab ui table columns(created using jide). But instead of getting sorted numerically, it is getting sorted based on string. Ex if i have 4,44,2,22,1,11 it gets sorted like 1,11,2,22,4,44 instead of 1,2,4,11,22,44

            Scroll=lib.findjobj(m.thandle);
            m.hjtable = Scroll.getViewport.getView;
            m.hjtable.setNonContiguousCellSelection(false);
            m.hjtable.setColumnSelectionAllowed(false);
            m.hjtable.setRowSelectionAllowed(true);




            % Make table sortable on columns
            m.hjtable.setSortable(true);
            m.hjtable.setAutoResort(true);
            m.hjtable.setMultiColumnSortable(true);
            m.hjtable.setPreserveSelectionsAfterSorting(true);
  • I want to sort the numbers this way (e.g. 145 129 90 2 -1) inside my uitable htable. Instead the following code sorts the numbers in that way (-1 129 145 2 90). It´s obvious that the program is just sorting after the first numeric value. Has someone got a clue about how to sort these numbers right? Below you will find the current code, which implements the sorting (Credits to Yair Altman). Many thanks in advance! – nivetha thiru Mar 28 '19 at 16:21
  • % Display the uitable and get its underlying Java object handle jscrollpane = findjobj(hTable); jtable = jscrollpane.getViewport.getView; % Now turn the JIDE sorting on jtable.setSortable(true); jtable.setAutoResort(true); jtable.setMultiColumnSortable(true); jtable.setPreserveSelectionsAfterSorting(true); – nivetha thiru Mar 28 '19 at 16:22
  • Please add updates to the question itself using [edit]. Comments are the wrong place for clarifications and code. – beaker Mar 28 '19 at 21:27

0 Answers0