Sort Codes generated with OpenSorter are not used by the Global parameter SortCode or SortCode arguments

Tech Note: TN0240
Product: OpenDeveloper
Version: <= 2.8
Date Added: 2007-02-19


The Global parameter SortCode, or argument SortCode for methods such as ReadEvents and ReadEventsV, cannot be used to define or condition the sort code of snippet events based on SortId results generated in OpenSorter. Even after SetUseSortName is called, the TTank server will use the default set of sort codes originally saved to the tank.

For example, the following MATLAB code fails to cache Snip events with sort code 1, from the OpenSorter generated sort set "Sort1" and uses the default "TankSort" sort set instead:

SetSort = TT.SetUseSortName('Sort1')
SCode = 1;
nEvents = TT.ReadEventsV(10000,'Snip',1,SCode,0.0,0.0,'All');


To use the alternate sort sets generated with OpenSorter, use the command SetFilterWithDescEx to set the sort code condition you want. Then use commands like ReadEventsV with the SortCode argument as 0, and the Options argument as 'FILTERED'. The MATLAB code below will work to read Snip events of channel = 1and sort code = 1 from the sort set saved as "Sort1".

SetSort1 = TT.SetUseSortName('Sort1');
AllSort1 = TT.ReadEventsV(10000,'Snip',1,0,0.0,0.0,'FILTERED');


Upgrade to the latest version of OpenDeveloper or use TDTbin2mat from the MATLAB SDK to extract sort code information. Note that a 0 in ReadEventsV will always return all sort codes, so you will still have to use the Workaround if you would like to extract ONLY events with SortCode = 0.