matlab.io.datastore.DsFileSet.reset - Reset the file-set object - MATLAB (original) (raw)

Main Content

Class: matlab.io.datastore.DsFileSet
Namespace: matlab.io.datastore

Reset the file-set object

Description

reset([fs](#mw%5F071dfced-53b3-4d44-a2fc-98a30744a3bc)) resets the file-set objectfs to the state where no file has been read from it. Resetting enables rereading from the same file-set object.

Input Arguments

Examples

Reset File-Set Object

Create a file-set object, get file information from the file-set object, and then reset the file-set object to its original state.

Create a file-set object for all the .mat files in thedemos folder.

folder = fullfile(matlabroot,'toolbox','matlab','demos'); fs = matlab.io.datastore.DsFileSet(folder,... 'IncludeSubfolders',true,... 'FileExtensions','.mat');

While there are files in the file-set object, get the file information one file at a time.

while hasfile(fs) file = nextfile(fs); end

The nextfile operation changes the position pointer in the file-set object. To get the information on the first file, you must firstreset the file-set object.

reset(fs); fTable1 = nextfile(fs); % first file information

Version History

Introduced in R2017b