As of R2023b, users can manually specify the indices in a cvpartition with the syntax
c = cvpartition("CustomPartition",testSets)
The details, including the possible formats for the "testSets" specification, are in the R2023b+ cvpartition doc https://www.mathworks.com/help/stats/cvpartition.html. This new feature is also mentioned in the R2023b SMLT release notes at https://www.mathworks.com/help/stats/release-notes.html.
If this answer helps you, please remember to accept the answer.