Loopfilereadr

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Purpose

An example function for reading files in a loop from a directory.

Synopsis

out = loopfilereadr(mydir,extension)

Description

The output is a structure array containing one file per elemnt. The "reader" function is xclreadr. The input is a directory and optional file extension. This function is written to work for CSV files containing one row of "variable" labels and one column "sample" labels. It is meant as a template for writing custom file reading within a loop. See comments in the code below for examples of changing "readers" and output argument.

Example of file contents:

,columnLabel_1,columnLabel_2,columnLabel_3
rowLabel_1,1,2,3
rowLabel_2,4,5,6
rowLabel_3,7,8,9

Inputs

  • mydir : directory (folder) to search, only searches single directory, no subdirectories.
  • extension : file extension to specify (optional).

Outputs

  • out : structure array with one dataset per element.

See Also

areadr, dataset, spcreadr, xclgetdata, xclputdata, xclreadr, xlsreadr