gridfile.divide
Divide the data in the current gridfile by a second gridfile
Syntax
Description
Divides the data in the current gridfile by a second gridfile, such that: New data = Current gridfile ./ second gridfile
Saves the result to a .mat file and catalogues it in a new .grid file. The names of the new files are specified by filename. Provide a single name to use the same name for both files. Provide two names to use different names for each file.
By default, each data dimension must have either the same length in both gridfiles, or a length of 1 in at least one file. If a dimension is only defined in one gridfile, it is treated as a singleton dimension in the second file. When a dimension is the same length in both files, it must have the same metadata along each dimension. When a dimension has a length of 1 in a gridfile, then the dimension is broadcast across the data in the second gridfile. See the “type” flag for alternate options regarding data size and metadata requirements.
The new gridfile will have the same dimensional metadata as the original gridfiles. Metadata for broadcast dimensions will match that of the non-broadcast file. If a dimension has a length of 1 in both gridfiles, the metadata will match that of gridfile calling the divide method. By default, the new file will have no metadata attributes (but see the “attributes” flag for alternate options).
obj.divide(…, ‘overwrite’, overwrite)
Specify whether to overwrite existing .mat and .grid files. If overwrite is scalar, uses the same option for both files. Use two elements to specify the option for each file individually. By default, does not overwrite existing files.
obj.divide(…, ‘attributes’, attributes)
Options for including metadata attributes in the new .grid file. If atts=1, copies the attributes from the current gridfile to the new file. If atts=2, copies the attributes from the second gridfile to the new file. If atts is a scalar struct, uses atts directly as the new metadata attributes.
obj.divide(…, ‘type’, type)
Specify how to implement division for the gridfiles. If case=1 (Default), requires the files to have compatible sizes for division, as well as the same metadata along each non-singleton dimension. If case=2, the files are not required to have compatible sizes. Instead, division only proceeds on data elements with the same metadata. If case=3, division proceeds directly on the file’s data, without metadata requirements. The two gridfiles are again required to have compatible sizes. The dimensional metadata of the new gridfile will match that of the current gridfile except when broadcasting over grid2.
obj.divide(…, ‘precision’, precision)
Specify the numerical precision of the data used for addition. If ‘single’ or ‘double’, uses the specified type. If unset or empty, uses double unless all loaded data is single by default.
Input Arguments
grid2
filename
overwrite
attributes
type
[1 (default)]: requires data dimensions to have compatible sizes AND have the same metadata along each non-singleton dimension. Does arithmetic on all data elements.
[2]: Searches for data elements with matching metadata in non-singleton dimensions. Only does arithmetic at these elements. Does not require data dimensions to have compatible sizes.
[3]: Does not compare dimensional metadata. Loads all data elements from both files and applies arithmetic directly. Requires data dimensions to have compatible sizes.
precision
Saves
A .mat and .grid file with the specified names