Loading of XML files aquired on Magnettech spectrometers fails in MATLAB R2021b.
These XML files store data in Base64 encoding. EasySpin's eprload uses the Apache Commons Codec (accessible in MATLAB as org.apache.commons.codec.binary.Base64) to decode them.
It appears that R2021b uses a newer version of the Apache Commons Codec that only decodes the initial part of the encoded string, equivalent to a single double floating point number.
The following example works in R2021a, but not in R2021b:
clc
data = 'yVs+u1W+dEA=G5zSMmK+dEA=bNxmqm6+dEA=vhz7IXu+dEA=EF2PmYe+dEA='; % encodes 5 doubles
data = typecast(int8(data),'uint8');
d = org.apache.commons.codec.binary.Base64.decodeBase64(data)
d(9:9:end) = [];
typecast(d,'double')
In R2021b, it just returns the first number. It appears that we need to implement an explicit loop in MATLAB - which will be slow.
Side note: Unlike R2021a, R2021b can handle char array input directly:
clc
data = 'yVs+u1W+dEA=G5zSMmK+dEA=bNxmqm6+dEA=vhz7IXu+dEA=EF2PmYe+dEA=';
d = org.apache.commons.codec.binary.Base64.decodeBase64(data)
typecast(d,'double')
Side note 2: Since R2016b, there exists matlab.net.base64decode (doc). Unfortunately, it also just returns one number:
clc
data = 'yVs+u1W+dEA=G5zSMmK+dEA=bNxmqm6+dEA=vhz7IXu+dEA=EF2PmYe+dEA=';
d = matlab.net.base64decode(data)
typecast(d,'double')
Loading of XML files aquired on Magnettech spectrometers fails in MATLAB R2021b.
These XML files store data in Base64 encoding. EasySpin's
eprload
uses the Apache Commons Codec (accessible in MATLAB asorg.apache.commons.codec.binary.Base64
) to decode them.It appears that R2021b uses a newer version of the Apache Commons Codec that only decodes the initial part of the encoded string, equivalent to a single double floating point number.
The following example works in R2021a, but not in R2021b:
In R2021b, it just returns the first number. It appears that we need to implement an explicit loop in MATLAB - which will be slow.
Side note: Unlike R2021a, R2021b can handle char array input directly:
Side note 2: Since R2016b, there exists
matlab.net.base64decode
(doc). Unfortunately, it also just returns one number: