フィルターのクリア

How to read RANDOM rows using DataStore

5 ビュー (過去 30 日間)
Mujahid Sultan
Mujahid Sultan 2018 年 6 月 26 日
回答済み: Rijuta 2023 年 12 月 22 日
ds = datastore('file_name.csv',... 'TreatAsMissing','NA', 'NumHeaderLines',1,'ReadVariableNames',false)
ds.MissingValue =0;
ds.ReadSize = 20000; % this will read sequential rows, I need to read random rows

回答 (1 件)

Rijuta
Rijuta 2023 年 12 月 22 日
Hi Mujahid,
I understand that you want to read random rows from a datastore in MATLAB.
Please follow the steps below:
  1. Create a datastore object that points to your data source using the 'datastore' function.
  2. Determine the number of rows in the datastore using the 'size' function.
  3. Generate random indices corresponding to the rows you want to read using the 'randperm' function.
  4. You can now use the 'read' function to read in the data, or 'readall' if you need to load all data into memory first.
Follow the documentation below to get a detailed description of the functions used:
I hope the above steps help you read random rows from a datastore.

カテゴリ

Help Center および File ExchangeDatastore についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by