Package: matlab.io.datastore
Add file writing support to datastore
matlab.io.datastore.FileWritable
is an abstract mixin class that adds file
writing support to custom datastores by adding support for the writeall
method.
To use this mixin class, you must inherit from the
matlab.io.datastore.FileWritable
class and the matlab.io.Datastore
base class. Use this syntax as the first few lines in your class definition
file:
classdef MyDatastore < matlab.io.Datastore & .... matlab.io.datastore.FileWritable ... end
Inherit from an additional class
matlab.io.datastore.FileWritable
.
Initialize the properties SupportedOutputFormats
and DefaultOutputFormat
.
Implement a write
method
if the datastore writes data to a custom format.
Implement a getFiles
method if the datastore does not have a Files
property.
Implement a getFolders
method if the datastore does not have a Folders
property.
The output location is validated as a string. If your datastore requires further
validation, you must implement a validateOutputLocation
method.
If the datastore is meant for files that require multiple reads per file, then you
must implement the methods getCurrentFilename
and currentFileIndexComparator
.
Optionally, inherit from another class matlab.io.datastore.FoldersPropertyProvider
to add support for a
Folders
property (and thus the FolderLayout
name-value pair of writeall
). If you do this, then you can use the
populateFoldersFromLocation
method in the datastore constructor to populate
the Folders
property.
To add support for the 'UseParallel'
option of
writeall
, you must subclass from both
matlab.io.datastore.FileWritable
and
matlab.io.datastore.Partitionable
and implement a
partition
method in the subclass that supports the syntax
partition(ds,'Files',index)
.
The matlab.io.datastore.FileWritable
class is a handle
class.