FILUM
File Utilities
FILUM,
a MATLAB library which
handles information in text files.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
FILUM is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
FILE_INCREMENT,
a MATLAB program which
makes a copy of a file containing an integer array, after incrementing
each entry by a given value.
FILE_NAME_SEQUENCE,
a MATLAB program which
demonstrates four ways to generate a sequence of filenames.
filum,
a MATLAB library which
can work with information in text files.
filum_test
Reference:
-
Paul Bratley, Bennett Fox, Linus Schrage,
A Guide to Simulation,
Springer Verlag, pages 201-202, 1983.
-
Tom Christiansen, Nathan Torkington,
"8.6: Picking a Random Line from a File",
Perl Cookbook, pages 284-285,
O'Reilly, 1999.
-
Pierre L'Ecuyer,
Random Number Generation,
in Handbook of Simulation,
edited by Jerry Banks,
Wiley Interscience, page 95, 1998.
-
Bennett Fox,
Algorithm 647:
Implementation and Relative Efficiency of Quasirandom
Sequence Generators,
ACM Transactions on Mathematical Software,
Volume 12, Number 4, pages 362-376, 1986.
-
Philip Lewis, Allen Goodman, James Miller,
A Pseudo-Random Number Generator for the System/360,
IBM Systems Journal,
Volume 8, pages 136-143, 1969.
Source Code:
-
ch_cap.m,
capitalizes a character;
-
ch_eqi.m,
returns true if two characters are equal, ignoring case;
-
ch_index_last.m,
returns the index of the last occurrence of a character in a string.
-
ch_is_digit.m,
returns true if a character is a decimal digit;
-
ch_low.m,
lowercases a character;
-
ch_to_digit.m,
converts a character to a decimal digit;
-
ch_to_rot13.m,
converts a character to its ROT13 equivalent;
-
digit_dec.m,
decrements a decimal digit;
-
digit_inc.m,
increments a decimal digit;
-
digit_to_ch.m,
converts a decimal digit to a character;
-
file_char_count.m,
counts the number of characters in a file;
-
file_column_count.m,
counts the number of columns in the first line of a file;
-
file_delete.m,
deletes a file;
-
file_exist.m,
is true if a file exists;
-
file_line_uniform.m,
returns a random line from a file;
-
file_line_width.m,
returns the length of the longest line in a file;
-
file_name_dec.m,
"decrements" a partially numeric filename;
-
file_name_ext_get.m,
gets the extension of a filename;
-
file_name_ext_swap.m,
replaces the current extension of a filename;
-
filename_inc.m,
"increments" a partially numeric filename;
-
file_name_inc_nowrap.m,
"increments" a partially numeric filename,
and "wrapping" is not allowed;
-
file_para_count.m,
counts the number of paragraphs in a file;
-
file_row_count.m,
counts the number of rows in a file;
-
file_sequence_delete.m,
deletes a file sequence.
-
file_sequence_read.m,
reads the data from a file sequence.
-
file_sequence_size.m,
sizes a file sequence.
-
file_tag_check.m,
makes a generalized parenthesis check on the text of a file;
-
file_unique.m,
makes a copy of the unique lines of a sorted file;
-
file_word_count.m,
counts the number of words in a file;
-
i4_uniform_ab.m,
returns a scaled pseudorandom I4;
-
number_inc.m,
increments the integer represented by a string;
-
r4_uniform_01.m,
returns a unit pseudorandom R4;
-
r8_uniform_01.m,
returns a unit pseudorandom R8;
-
s_adjustl.m,
shifts a string to the left, "squeezing out" the leading blanks.
-
s_cat.m,
concatenates two strings;
-
s_eqi.m,
is true if two strings are equal, disregarding case;
-
s_index.m,
returns the index of the first occurrence of a substring in a string.
-
s_len_trim.m,
returns the length of a string to the last nonblank;
-
s_low.m,
makes a lowercase copy of a string;
-
s_reverse.m,
reverses a string;
-
s_to_r8.m,
reads an R8 from a string;
-
s_to_r8vec.m,
reads an R8VEC from a string;
-
s_to_rot13.m,
converts a string to its ROT13 equivalent;
-
s_word_count.m,
counts the number of "words" in a string;
-
timestamp.m,
prints the HMSDMY date as a timestamp;
Examples and Tests:
-
filum_test.m,
calls all the tests;
-
filum_test.sh,
runs all the tests;
-
filum_test.txt,
the output file;
-
filum_test02.m,
tests FILE_CHAR_COUNT;
-
filum_test03.m,
tests FILE_COLUMN_COUNT;
-
filum_test06.m,
tests FILE_EXIST;
-
filum_test085.m,
tests FILE_LINE_WIDTH;
-
filum_test11.m,
tests FILE_NAME_DEC;
-
filum_test13.m,
tests FILE_NAME_EXT_SWAP;
-
filum_test14.m,
tests FILE_NAME_INC;
-
filum_test15.m,
tests FILE_NAME_INC;
-
filum_test17.m,
tests FILE_PARA_COUNT;
-
filum_test22.m,
tests FILE_ROW_COUNT;
-
filum_test_4by5.txt,
a file with missing right parentheses;
-
story.txt,
a file containing a title line and 5 paragraphs of text.
DATA_***.TXT is a short sequence of three files, each having 8 data
items, 3 on the first line, 3 on the second, and 2 on the third line,
to be examined by FILE_SEQUENCE_SIZE.
MARCUS_TEST is an example that demonstrates how FILE_NAME_INC
and FILE_NAME_DEC can be used to generate, save, and recover
iterative data;
Last revised on 21 January 2019.