textline.m

来自「toolbox of BVQX, This is the access betw」· M 代码 · 共 41 行

M
41
字号
function tline = textline(ttext, starts, ends, lnum)
% textline  - one line from a multi-line 1xN char array
%
% FORMAT:       tline = textline(ttext, starts, ends, lnum)
%
% Input fields:
%
%       ttext       1xN char array
%       starts      1xN double array with line start positions
%       ends        1xN double array with line end positions
%       lnum        1x1 double, line number
%
% Output fields:
%
%       tline       line of text
%
% See also asciiread.

% Version:  v0.5c
% Build:    6120415
% Date:     Dec-04 2006, 3:15 PM CET
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin < 4 || ...
    length(size(start)) ~= length(size(ends)) || ...
    any(size(starts) ~= size(ends)) || ...
    isempty(lnum(:)) || ...
    lnum(1) > numel(starts) || ...
    lnum(1) < 1
    error( ...
        'BVQXtools:BadArgument', ...
        'Bad or missing argument.' ...
    );
end

% return textline
lnum = fix(lnum(1));
tline = ttext(starts(lnum):ends(lnum));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?