This is a common situation when trying to adapt experimental setups from existing papers to a different dataset. The paper by Zheng & Lu (2015) talks about using 15 subjects, each with 2 sessions, and mentions that “the training set contains nine sessions, while the test set contains six sessions from the same experiment.” That part can be a bit confusing at first glance.
What they seem to be doing is splitting the data at the session level, not the trial level. So, it is not about picking 9 trials for training and 6 for testing from the same session — instead, full sessions are used as independent blocks. Each session contains multiple trials, but those trials stay together during splitting.
Now, if the dataset has 15 subjects with 3 sessions each, there is a bit more flexibility. A few ways to set up the train/test split that still follow the spirit of the paper:
- Stick to session-level splits. Pick 9 full sessions (could be one session each from 9 subjects) for training, and 6 different sessions for testing. Rotate through the remaining sessions in cross-validation style.
 - Another option is to stay within subjects. For each subject, train on one session and test on another. With three sessions, all pairwise combinations can be used: (1→2), (1→3), (2→3), etc. Then average the results over all subjects.
 
Here is a rough example of how to organize the session-level splits in MATLAB:
sessionPairs = combvec(1:15, 1:3)'; 
perm = randperm(size(sessionPairs,1));
trainSessions = sessionPairs(perm(1:9), :);
testSessions = sessionPairs(perm(10:15), :);
And if the idea is to do it within each subject:
trainData = eegData{subj}.session{1};
testData = eegData{subj}.session{2};
Either of these keeps the training and testing data cleanly separated at the session level, which is important when working with EEG to avoid overfitting or data leakage.
Some useful MATLAB references that can help with this setup: