Sorting a Matlab Uitable with JIDE

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Sorting a Matlab Uitable with JIDE

Postby JAFAULH » Mon Jun 04, 2018 10:07 am

Hey guys,

I am using JIDE within a Matlab uitable. Thereby I got columns with elements of double type. These elements corespond to temperature values from -300 to +250. I now want to sort them to easily check which is the highest/lowest. Therefore I am using following code to enable sorting. My Problem is, that instead of sorting numbers this way (e.g. 145 129 90 2 -1) , the data gets sorted like this (-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? I suppose I will have to Change the way the program compares/sorts These elements. Perhaps there is something to do with its comparators?!

Code: Select all
% 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);


Many thanks in advance!
JAFAULH
 
Posts: 1
Joined: Mon Jun 04, 2018 7:33 am

Re: Sorting a Matlab Uitable with JIDE

Postby JIDE Support » Mon Jun 04, 2018 8:06 pm

I don't know about the matlab. If you use JIDE APIs, you can determine the data type. If the data type is string, it will sort the way you mentioned. But if the data is numeric, it will sort them as number. I don't know how you specific the data type in matlab because it is done through a Java class called TableModel.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36368
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 1 guest

cron