Retrieve or set sample names in ExptData object


SamNames = sampleNames(EDObj)
SamNames = sampleNames(EDObj, Subset)
NewEDObj = sampleNames(EDObj, Subset, NewSamNames)


SamNames = sampleNames(EDObj) returns a cell array of strings specifying all sample names in an ExptData object.

SamNames = sampleNames(EDObj, Subset) returns a cell array of strings specifying a subset the sample names in an ExptData object.

NewEDObj = sampleNames(EDObj, Subset, NewSamNames) replaces the sample names specified by Subset in EDObj, an ExptData object, with NewSamNames, and returns NewEDObj, a new ExptData object.

Input Arguments


Object of the class.


One of the following to specify a subset of the sample names in an ExptData object:

  • String specifying a sample name

  • Cell array of strings specifying sample names

  • Positive integer

  • Vector of positive integers

  • Logical vector


New sample names for specific sample names within an ExptData object, specified by one of the following:

  • Numeric vector

  • String or cell array of strings

  • String, which sampleNames uses as a prefix for the sample names, with sample numbers appended to the prefix

  • Logical true or false (default). If true, sampleNames assigns unique sample names using the format Sample1, Sample2, etc.

The number of sample names in NewSamNames must equal the number of samples specified by Subset.

Output Arguments


Cell array of strings specifying all or some of the sample names in an ExptData object. The sample names are the column names in the DataMatrix objects in the ExptData object.


Object of the class, returned after replacing specific sample names.


Construct an ExptData object, and then retrieve the sample names from it:

% Import package to make constructor functions
% available
% Create DataMatrix object from .txt file containing 
% expression values from microarray experiment
dmObj = DataMatrix('File', 'mouseExprsData.txt');
% Construct ExptData object
EDObj = ExptData(dmObj);
% Retrieve sample names
SNames = sampleNames(EDObj);
Was this topic helpful?