size

Class: bioma.data.MetaData
Package: bioma.data

Return size of MetaData object

Syntax

NSamVar = size(MDObj)
[NSamples, NVariables] = size(MDObj)
DimLength = size(MDObj, Dim)

Description

NSamVar = size(MDObj) returns a two-element row vector containing the number of samples or features and number of variables in a MetaData object.

[NSamples, NVariables] = size(MDObj) returns the number of samples or features and the number of variables in a MetaData object as separate variables.

DimLength = size(MDObj, Dim) returns the length of the dimension specified by Dim.

Input Arguments

MDObj

Object of the bioma.data.MetaData class.

Dim

Scalar specifying the dimension of the MetaData object. Choices are:

  • 1 — Samples

  • 2 — Variables

Examples

Construct a MetaData object, and then determine the number of samples and variables in it:

% Import bioma.data package to make constructor function
% available
import bioma.data.*
% Construct MetaData object from .txt file
MDObj2 = MetaData('File', 'mouseSampleData.txt', 'VarDescChar', '#');
% Retrieve the number of samples and variables
NumSamVar = size(MDObj2)