This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

readall

Read all data in datastore

Syntax

data = readall(ds)

Description

example

data = readall(ds) returns all the data in the datastore specified by ds.

If all the data in the datastore does not fit in memory, then readall returns an error.

Examples

collapse all

Create a datastore from the sample file airlinesmall.csv, which contains tabular data.

ds = tabularTextDatastore('airlinesmall.csv','TreatAsMissing','NA');

Modify the SelectedVariableNames property to specify the variables of interest.

ds.SelectedVariableNames = {'DepTime','ArrTime','ActualElapsedTime'};

Read all the data in the datastore.

T = readall(ds);

readall returns all the data in a table.

View information about the table.

T.Properties
ans = 
  TableProperties with properties:

             Description: ''
                UserData: []
          DimensionNames: {'Row'  'Variables'}
           VariableNames: {'DepTime'  'ArrTime'  'ActualElapsedTime'}
    VariableDescriptions: {}
           VariableUnits: {}
      VariableContinuity: []
                RowNames: {}
        CustomProperties: No custom properties are set.
      Use addprop and rmprop to modify CustomProperties.

View a summary of the output table.

summary(T)
Variables:

    DepTime: 123523x1 double

        Values:

            Min             1      
            Median          1335   
            Max             2505   
            NumMissing      2351   

    ArrTime: 123523x1 double

        Values:

            Min             1      
            Median          1522   
            Max             2608   
            NumMissing      2656   

    ActualElapsedTime: 123523x1 double

        Values:

            Min                  11          
            Median               102         
            Max                  1650        
            NumMissing           2657        

Create a datastore from the sample file, mapredout.mat, which is the output file of the mapreduce function.

ds = datastore('mapredout.mat');

Read all the data in the datastore.

T = readall(ds);

View a summary of the output table.

summary(T)
Variables:

    Key: 29x1 cell array of character vectors

    Value: 29x1 cell

Input Arguments

collapse all

Input datastore. You can use the datastore function to create a datastore object from your data.

Output Arguments

collapse all

All data in the datastore, returned as a table or cell array.

  • For TabularTextDatastore and SpreadsheetDatastore objects, data is a table with variables corresponding to the SelectedVariableNames property.

  • For ImageDatastore objects, data is a cell array where each element displays the size and data type of the corresponding image data. For example, [480x640x3 uint8] describes the size of uint8 data corresponding to a color image.

  • For KeyValueDatastore objects, data is a table whose variable names are Key and Value.

  • For FileDatastore objects, data is a cell array containing the data returned by the read function that is specified by the 'ReadFcn' parameter value in the fileDatastore function.

See Also

| |

Introduced in R2014b