mhdrload.m

版本 1.0.0.0 (2.4 KB) 作者: Jeffrey Daniels
Load data from an ASCII file containing multiple text headers throughout the file.
6.6K 次下载
更新时间 2006/9/21

无许可证

function [header_mat,data_mat] = mhdrload(file)
%MHDRLOAD Load data from an ASCII file containing multiple text
% headers throughout the file.
% [header, data] = MHDRLOAD('filename.ext') reads a data file
% called 'filename.ext', which contains a text header. There
% is no default extension; any extensions must be explicitly
% supplied.
%
% The first output, HEADER, is the header information, returned
% as a text array.
% The second output, DATA, is the data matrix. This data matrix
% has the same dimensions as the data in the file, one row per
% line of ASCII data in the file. If the data is not regularly
% spaced (i.e., each line of ASCII data does not contain the
% same number of points), the data is returned as a column
% vector.
%
% Limitations: No lines of the text header can begin with
% a number. The header must come before the data.
%
% MODIFIED from hdrload.m: Dec 20, 2002 Jeff Daniels, NSWCCD - ARD
% UPDATED September 20, 2006, J. Daniels
%
% See also LOAD, SAVE, SPCONVERT, FSCANF, FPRINTF, STR2MAT, HDRLOAD.
% See also the IOFUN directory.
%
% EXAMPLE:
% If example_data.txt is:
% Recorded Data: 12/15/2001
% header 1
% rows = 2 cols = 2
% 12 23
% 34 21
% header 2
% rows = 3 cols = 3
% 19 73 13
% 33 32 47
% 34 12 68
%
% MHDRLOAD returns:
% header(:,:,1) =
%
% Recorded Data: 12/15/2001
% header 1
% rows = 2 cols = 2
%
% header(:,:,2) =
%
% header 2
% rows = 3 cols = 3
%
% data(:,:,1) =
%
% 12 23 0
% 34 21 0
% 0 0 0
%
% data(:,:,2) =
%
% 19 73 13
% 33 32 47
% 34 12 68

引用格式

Jeffrey Daniels (2024). mhdrload.m (https://www.mathworks.com/matlabcentral/fileexchange/2973-mhdrload-m), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R12
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 String Parsing 的更多信息
致谢

启发作品: RPTRead(fname)

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Updated with suggestions from user comments and M-Lint Report.