⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hexdump.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function hd = hexdump(av)
% hexdump  - dump hexadecimal values into string
%
% FORMAT:       hd = hexdump(asciivals)
%
% Input fields:
%
%       asciivals   1xN double or char array
%
% Output fields:
%
%       hd          hexdumped string
%
% See also bitdump

% 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 < 1 || ...
   (~ischar(av) && ...
    ~isa(av, 'double'))
    error( ...
        'BVQXtools:BadArgument', ...
        'Missing or wrong argument.' ...
    );
end

% get lenth and size
l = length(av);
p = 1;

% prepare output
hd = '';

% iterate until end
while (p < l)

    % get stretch
    pa = av(p:min(p+15, l));

    % print into string
    hd = [hd sprintf('%08X:  %-50s %-16s\n', p - 1, ...
        sprintf('%02X ', double(pa)), ...
        saveascii(pa))];

    % go on
    p = p + 16;
end


% internal function to remove ascii characters
function sa = saveascii(av)
    av(av < 32 | av > 127) = 46;
    sa = sprintf('%c', av);
% end of function sa = saveascii(av)

⌨️ 快捷键说明

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