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. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Subset of data in datastore


data = preview(ds)



data = preview(ds) returns a subset of data from datastore ds without changing its current position.


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'};

Preview the data for the selected variables.

data = preview(ds)
data=8x3 table
    DepTime    ArrTime    ActualElapsedTime
    _______    _______    _________________

     642        735        53              
    1021       1124        63              
    2055       2218        83              
    1332       1431        59              
     629        746        77              
    1446       1547        61              
     928       1052        84              
     859       1134       155              

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

ds = datastore('mapredout.mat');

Preview the data in the datastore.

data = preview(ds)
data=1x2 table
    Key      Value 
    ____    _______

    'AA'    [14930]

Input Arguments

collapse all

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

Output Arguments

collapse all

Subset of data, returned as a table or an array of integers.

Type of datastoreDescription
TabularTextDatastore and SpreadsheetDatastoreTable with variables specified by the SelectedVariableNames property. The table contains at most eight rows.
ImageDatastoreArray of integers corresponding to the first image.
KeyValueDatastoreTable with the variables Key and Value.
FileDatastoreTable containing the output returned by the read function, specified by the 'ReadFcn' parameter in the fileDatastore function.

See Also


Introduced in R2014b

Was this topic helpful?