Util_GetFileInfo

Returns the number of channels, header lines, and the delimiter string for a given text file.
172 Downloads
Updated 13 Feb 2012

View License

The Util_GetFileInfo function returns the number of channels, header lines, and the delimiter string for the file with name FILENAME.

Several assumptions are made about the data file:
1. The last line in the file contains a representative line of data
2. The delimiter is either a comma, semicolon, tab, or space
3. In a line of data, the number of actual delimiters exceeds the number of any of the other candidate delimiters (commas, tabs, &c.)
4. The first three lines of data have matching data types (i.e., number or string) and all have the correct number of channels. Everything preceding this point is considered to be the header.

INPUTS:
> FILENAME - the name of the file whose number of channels, number of header lines, and delimiter string will be determined.

OUTPUTS:
> CHAN - the number of channels in the data file
> HEADERLINES - the number of header lines in the data file
> DELIM - the data file's delimiter string (e.g., ';')
> PATTERN - the pattern string to be used in file loading (e.g., %f%f%f)

Written by Alex Andrews.
Last updated: February 13th, 2012.

-----------------------------------
FeatureFinder is a free MATLAB tool that lets you organize your signals, visually review them with speed and ease, apply filters and normalization, and export meaningful signal features in a ready-to-analyze format. Learn more at www.featurefinder.ca.

Cite As

Feature Finder (2024). Util_GetFileInfo (https://www.mathworks.com/matlabcentral/fileexchange/35063-util_getfileinfo), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0