- Create a datastore object that points to your data source using the 'datastore' function.
- Determine the number of rows in the datastore using the 'size' function.
- Generate random indices corresponding to the rows you want to read using the 'randperm' function.
- You can now use the 'read' function to read in the data, or 'readall' if you need to load all data into memory first.
- 'datastore' function: https://www.mathworks.com/help/matlab/datastore.html
- 'randperm' function: https://www.mathworks.com/help/matlab/ref/randperm.html
- 'read' function: https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.read.html
- 'readall' function: https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.readall.html