资源简介
matlab读取xml文件,使用这个包只需要很简单的代码就可以很方便的读取xml文件,不需要自己去写读取文件的代码了

代码片段和文件信息
function y = base64decode(x outfname alg)
%base64DECODE Perform base64 decoding on a string.
%
% INPUT:
% x - block of data to be decoded. Can be a string or a numeric
% vector containing integers in the range 0-255. Any character
% not part of the 65-character base64 subset set is silently
% ignored. Characters occuring after a ‘=‘ padding character are
% never decoded. If the length of the string to decode (after
% ignoring non-base64 chars) is not a multiple of 4 then a
% warning is generated.
%
% outfname - if provided the binary date from decoded string will be
% saved into a file. Since base64 coding is often used to embbed
% binary data in xml files this option can be used to extract and
% save them.
%
% alg - Algorithm to use: can take values ‘java‘ or ‘matlab‘. Optional
% variable defaulting to ‘java‘ which is a little faster. If
% ‘java‘ is chosen than core of the code is performed by a call to
% a java library. Optionally all operations can be performed using
% matleb code.
%
% OUTPUT:
% y - array of binary data returned as uint8
%
% This function is used to decode strings from the base64 encoding specified
% in RFC 2045 - MIME (Multipurpose Internet Mail Extensions). The base64
% encoding is designed to represent arbitrary sequences of octets in a form
% that need not be humanly readable. A 65-character subset ([A-Za-z0-9+/=])
% of US-ASCII is used enabling 6 bits to be represented per printable
% character.
%
% See also base64ENCODE.
%
% Written by Jarek Tuszynski SAIC jaroslaw.w.tuszynski_at_saic.com
%
% Matlab version based on 2004 code by Peter J. Acklam
% E-mail: pjacklam@online.no
% URL: http://home.online.no/~pjacklam
% http://home.online.no/~pjacklam/matlab/software/util/datautil/base64encode.m
if nargin<3 alg=‘java‘; end
if nargin<2 outfname=‘‘; end
%% if x happen to be a filename than read the file
if (numel(x)<256)
if (exist(x ‘file‘)==2)
fid = fopen(x‘rb‘);
x = fread(fid ‘uint8‘);
fclose(fid);
end
end
x = uint8(x(:)); % unify format
%% Perform conversion
switch (alg)
case ‘java‘
base64 = org.apache.commons.codec.binary.base64;
y = base64.decode(x);
y = mod(int16(y)256); % convert from int8 to uint8
case ‘matlab‘
%% Perform the mapping
% A-Z -> 0 - 25
% a-z -> 26 - 51
% 0-9 -> 52 - 61
% + - -> 62 ‘-‘ is URL_SAFE alternative
% / _ -> 63 ‘_‘ is URL_SAFE alternative
map = uint8(zeros(1256)+65);
map(uint8([‘A‘:‘Z‘ ‘a‘:‘z‘ ‘0‘:‘9‘ ‘+/=‘]))= 0:64;
map(uint8(‘-_‘))= 62:63; % URL_SAFE alternatives
x = map(x); % mapping
x(x>64)=[]; % remove non-base64 chars
if rem(numel(x) 4)
warning(‘Length of base64 data not a multiple of 4; padding input.‘);
end
x(x==64)=[]; % remove padding characters
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4310 2010-11-05 23:57 xm
文件 4962 2010-11-06 00:00 xm
文件 4860 2010-08-19 00:11 xm
文件 1318 2014-02-12 13:19 xm
文件 527 2007-07-04 09:27 xm
文件 3746 2007-07-13 09:47 xm
文件 24408 2010-10-05 21:26 xm
文件 36816 2010-11-06 04:20 xm
文件 18772 2010-11-04 04:30 xm
目录 0 2018-08-15 17:30 xm
----------- --------- ---------- ----- ----
99719 10
- 上一篇:比特翻转译码
- 下一篇:某三角闸门 ANSYS 命令流
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论