|
From: | randm.deakin |
Subject: | load function with ascii text file |
Date: | Sat, 7 Jan 2017 05:56:13 +0000 |
Dear Help, I’ve downloaded Octave v4.2 onto my Microsoft Surface 2 Pro (Windows 8.1) and I’ve been running some simple Matlab m-files. Some of these files (functions) use the function ‘load’ that reads ascii data from a text file. These text files have rows and columns of numbers as well as comment lines with a % symbol in column 1. Matlab conveniently ignores these lines when load is invoked but Octave does not. Can you suggest a way of reading data with comment lines? Here’s an example data file below % Pearson_Line_Data.txt % Line data from Pearson (1901, p.569) % % Pearson, K., 1901, 'On lines and planes of closest fit to systems of % points in space', Philosophical Magazine, Vol. 2, pp. 559-572 % % serial x(i) sd_x y(i) sd_y covariance 1 0.0 0.1 5.9 0.1 0 2 0.9 0.1 5.4 0.1 0 3 1.8 0.1 4.4 0.1 0 4 2.6 0.1 4.6 0.1 0 5 3.3 0.1 3.5 0.1 0 6 4.4 0.1 3.7 0.1 0 7 5.2 0.1 2.8 0.1 0 8 6.1 0.1 2.8 0.1 0 9 6.5 0.1 2.4 0.1 0 10 7.4 0.1 1.5 0.1 0 % end of data The block of data are the lines without % symbol in column 1. Regards Rod Deakin |
[Prev in Thread] | Current Thread | [Next in Thread] |