Main Content

write

Class: matlab.io.datastore.FileWritable
Namespace: matlab.io.datastore

Write block of data

Since R2020a

Syntax

tf = write(ds,data,info,outputFormat)
tf = write(ds,data,info,outputFormat,varargin)

Description

tf = write(ds,data,info,outputFormat) writes a chunk of data from the datastore and returns a value of logical 1 (true) if the operation is successful.

If your custom datastore subclasses from matlab.io.datastore.FileWritable, then it inherits a write method that is capable of writing data for known datastore formats. However, if your custom datastore works with custom data formats, then you must implement your own write method in the subclass. This method must be capable of writing data in any format listed in the SupportedOutputFormats property of the class.

tf = write(ds,data,info,outputFormat,varargin) also specifies one or more additional input arguments, which are passed to the write method as a varargin cell array.

Input Arguments

expand all

Input datastore, specified as a datastore object that inherits from matlab.io.datastore.FileWritable. To create a datastore object, see matlab.io.Datastore.

Block of data from read, specified as a table or array depending on the type of datastore.

Information about data from read, specified as a structure array or cell array depending on the type of datastore.

Output format, specified as a character vector or string scalar.

Variable length input, specified as separate input arguments of any type. The write method has four required inputs, and any additional inputs are passed to the method as a cell array. (See varargin for an explanation.) You can use this functionality to pass name-value pairs, optional flags, or parameters for use in the body of the write method.

Attributes

Accessprotected

To learn about attributes of methods, see Method Attributes.

Version History

Introduced in R2020a