07-Jan-2022 20:08:14 filum_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test filum(). file_char_count_test file_char_count counts the characters in a file. Examining file: "story.txt". Number of characters in file: 566 file_column_count_test file_column_count() counts the columns in a file. It is assumed that the file contains a number of lines, with each line containing the same number of words. The task is to determine the number of words in a line, that is, the number of "columns" of text. Examining the file "filum_test_4by5.txt" Number of columns = 5 file_exist_test file_exist() is true if a file exists. Exist? FILENAME 1 filum_test.m 1 filum.html 0 rabbit.txt 0 make.money.fast FILUM_TEST0021 FILE_PARA_COUNT counts the paragraphs in a file. Examining file: "story.txt". Number of paragraphs: 6 FILUM_TEST0035 FILE_EXIST is true if a file exists. Exist? FILENAME 1 filum_test.m 1 filum.html 0 rabbit.txt 0 make.money.fast FILUM_TEST0048 FILENAME_DEC decrements a string Input Output file???.dat (Empty output string. Quit loop!) file076.dat file075.dat file075.dat file074.dat file074.dat file073.dat file073.dat file072.dat 3cat3.dat 3cat2.dat 3cat2.dat 3cat1.dat 3cat1.dat 3cat0.dat 3cat0.dat 2cat9.dat fred03.txt fred02.txt fred02.txt fred01.txt fred01.txt fred00.txt fred00.txt fred99.txt FILUM_TEST006 FILENAME_EXT_SWAP changes a file extension. Input Output FILENAME EXT FILENAME bob.for obj bob.obj bob.bob.bob txt bob.bob.txt bob. yak bob.yak bob ps bob .ps .oops eek .eek FILUM_TEST007 FILENAME_INC increments a string Input Output file???.dat (Empty output string. Quit loop!) (Empty output string. Quit loop!) (Empty output string. Quit loop!) (Empty output string. Quit loop!) file072.dat file073.dat file073.dat file074.dat file074.dat file075.dat file075.dat file076.dat 2cat9.dat 3cat0.dat 3cat0.dat 3cat1.dat 3cat1.dat 3cat2.dat 3cat2.dat 3cat3.dat fred99.txt fred00.txt fred00.txt fred01.txt fred01.txt fred02.txt fred02.txt fred03.txt FILUM_TEST085 FILE_LINE_WIDTH counts the longest line in a file. Examining file: "story.txt". Longest line length: 52 FILUM_TEST012 FILE_COLUMN_COUNT counts the columns in a file. It is assumed that the file contains a number of lines, with each line containing the same number of words. The task is to determine the number of words in a line, that is, the number of "columns" of text. Examining the file "filum_test_4by5.txt" Number of columns = 5 FILUM_TEST015 FILENAME_INC "increments" a string. In this example, the string is a file name. The user is going to carry out several simulations. For each simulation, a consecutive series of file names is desired. Begin simulation 1 file_01_001.txt file_01_002.txt file_01_003.txt file_01_004.txt Begin simulation 2 file_02_001.txt file_02_002.txt file_02_003.txt file_02_004.txt Begin simulation 3 file_03_001.txt file_03_002.txt file_03_003.txt file_03_004.txt Begin simulation 4 file_04_001.txt file_04_002.txt file_04_003.txt file_04_004.txt Begin simulation 5 file_05_001.txt file_05_002.txt file_05_003.txt file_05_004.txt FILUM_TEST085 FILE_LINE_WIDTH counts the longest line in a file. Examining file: "story.txt". Longest line length: 52 FILUM_TEST11 FILENAME_DEC decrements a string Input Output file???.dat (Empty output string. Quit loop!) file072.dat file071.dat file071.dat file070.dat file070.dat file069.dat 2cat9.dat 2cat8.dat 2cat8.dat 2cat7.dat 2cat7.dat 2cat6.dat fred99.txt fred98.txt fred98.txt fred97.txt fred97.txt fred96.txt FILUM_TEST13 FILENAME_EXT_SWAP changes a file extension. Input Output FILENAME EXT FILENAME bob.for obj bob.obj bob.bob.bob txt bob.bob.txt bob. yak bob.yak bob ps bob .ps .oops eek .eek FILUM_TEST14 FILENAME_INC increments a string Input Output file???.dat (Empty output string. Quit loop!) file072.dat file073.dat file073.dat file074.dat file074.dat file075.dat file075.dat file076.dat 2cat9.dat 3cat0.dat 3cat0.dat 3cat1.dat 3cat1.dat 3cat2.dat 3cat2.dat 3cat3.dat fred98.txt fred99.txt fred99.txt fred00.txt fred00.txt fred01.txt fred01.txt fred02.txt FILUM_TEST15 FILENAME_INC "increments" a string. In this example, the string is a file name. The user is going to carry out several simulations. For each simulation, a consecutive series of file names is desired. Begin simulation 1 file_01_001.txt file_01_002.txt file_01_003.txt file_01_004.txt Begin simulation 2 file_02_001.txt file_02_002.txt file_02_003.txt file_02_004.txt Begin simulation 3 file_03_001.txt file_03_002.txt file_03_003.txt file_03_004.txt Begin simulation 4 file_04_001.txt file_04_002.txt file_04_003.txt file_04_004.txt Begin simulation 5 file_05_001.txt file_05_002.txt file_05_003.txt file_05_004.txt FILUM_TEST165 FILENAME_INC_NOWRAP increments a string but does not allow "wrapping". Input Output file???.dat (Empty output string. Quit loop!) file072.dat file073.dat file073.dat file074.dat file074.dat file075.dat file075.dat file076.dat 2cat9.dat 3cat0.dat 3cat0.dat 3cat1.dat 3cat1.dat 3cat2.dat 3cat2.dat 3cat3.dat fred98.txt fred99.txt fred99.txt (Empty output string. Quit loop!) FILUM_TEST17 FILE_PARA_COUNT counts the paragraphs in a file. Examining file: "story.txt". Number of paragraphs: 6 FILUM_TEST22 FILE_ROW_COUNT counts the rows in a file. Examining the file "filum_test_data.txt" Number of rows = 16 FILUM_TEST225 FILE_SEQUENCE_SIZE "sizes" the files in a file sequence. Examining files in sequence starting with: "data_100.txt". Number of files: 3 Number of data items: 8 MARCUS_TEST MATLAB version Show how to save iterative data in files with incremented names; Show how to retrieve data by reading the files in in reverse order. The routines we use are: FILENAME_INC: increments a file name; FILENAME_DEC: decrements a file name; Generate and save the data: I X Y Z(1) Z(2) fred001.mat 1 1.000000 1.000000 0.814724 0.905792 fred002.mat 2 2.000000 4.000000 0.126987 0.913376 fred003.mat 3 3.000000 9.000000 0.632359 0.097540 fred004.mat 4 4.000000 16.000000 0.278498 0.546882 fred005.mat 5 5.000000 25.000000 0.957507 0.964889 fred006.mat 6 6.000000 36.000000 0.157613 0.970593 fred007.mat 7 7.000000 49.000000 0.957167 0.485376 fred008.mat 8 8.000000 64.000000 0.800280 0.141886 fred009.mat 9 9.000000 81.000000 0.421761 0.915736 fred010.mat 10 10.000000 100.000000 0.792207 0.959492 Recover the data in reverse order: I X Y Z(1) Z(2) fred010.mat 10 10.000000 100.000000 0.792207 0.959492 fred009.mat 9 9.000000 81.000000 0.421761 0.915736 fred008.mat 8 8.000000 64.000000 0.800280 0.141886 fred007.mat 7 7.000000 49.000000 0.957167 0.485376 fred006.mat 6 6.000000 36.000000 0.157613 0.970593 fred005.mat 5 5.000000 25.000000 0.957507 0.964889 fred004.mat 4 4.000000 16.000000 0.278498 0.546882 fred003.mat 3 3.000000 9.000000 0.632359 0.097540 fred002.mat 2 2.000000 4.000000 0.126987 0.913376 fred001.mat 1 1.000000 1.000000 0.814724 0.905792 filum_test(): Normal end of execution. 07-Jan-2022 20:08:14