Load data from ASCII files into a variable.
Syntax
data = loadasc(filename)
data = loadasc(filename,ASCIItype)
Description
loadasc loads the contents of the ASCII file filename into data. In some sense, this is an "intelligent" version of load, where
ASCIItype may have the value 'flat', in this case the load command is directly used, or 'text', which means that the file contains some textual information which has to be deleted during the loading, or the number of numbers in a line may vary from line to line. The filtering of the file is done using the command sscanf, available in MATLAB Version 4.0 or higher. Everything after a % character in a line is ignored, and the rest is searched for numbers. loadasc will read the file properly into a vector even if it is not provided the same number of elements in each line if used with the option 'text'.
The resulting variable data is a column vector, unless ASCIItype is set to 'flat' and each line of the flat ASCII file contains more than one number (but the number of elements in each row must be the same in a flat ASCII file).
Default Argument Values
ASCIItype = 'text'
Examples
fprintf('lasctest.txt',...
'%.0f %%N\n%.4e, %.4e %%amp1\n',1,5,6)
type lasctest.txt, v3 = loadasc('lasctest.txt')
See Also
load
[ Previous | Help Desk | Next ]