資源簡介
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 命令流
評論
共有 條評論