资源简介
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 命令流
相关资源
- qc_ldpc矩阵构造
- 基于DCT变换的图像压缩算法
- 8QAM、QPSK误码率计算matlab程序
- 解释结构模型ISM的matlab实现代码
- BP网络训练MATLAB程序
- matlab坐标转换
- SVPWM MATLAB仿真
- matlab视日轨迹跟踪算法仿真程序
- cnn程序 matlab
- 排队论的matlab仿真(包括仿真代码)
- libsvm网格法查找最优参数函数 SVMcgF
- libsvm网格法查找最优解函数 SVMcgForC
- B样条程序MATLAB编写
- 布尔沙模型求七参数
- Matlab 人脸识别 SVM
- matlab遗传算法求解VRP问题
- delaunay三角剖分matlab代码,有注释
- MIMO复用技术MATLAB仿真代码
- 用MATLAB实现GAC模型
- dea模型matlab代码,三个dea模型,超效
- 基于MATLAB的Fisher线性判别代码
- 多尺度retinex算法,图像增强
- CT最大密度投影matlab
- matlab版随机森林工具箱-用于分类和回
- 生成布朗桥的MATLAB代码
- Powell法最优化设计matlab程序
- CDMA MATLAB仿真
- 三相PWM整流matlab仿真
- 三层神经网络模型matlab版
- 贝叶斯网络matlab工具箱使用说明
评论
共有 条评论