diff --git a/jdatadecode.m b/jdatadecode.m
index 13109386650d72e21e6db18f0b440417dc932dae..026d2cb7e17f4b67a4636ed5703fb8834ae72505 100644
--- a/jdatadecode.m
+++ b/jdatadecode.m
@@ -123,7 +123,7 @@ function newdata=jdatadecode(data,varargin)
             if(isfield(data,N_('_ArrayZipType_')))
                 zipmethod=data(j).(N_('_ArrayZipType_'));
             end
-            if(ismember(zipmethod,{'zlib','gzip','lzma','lzip','lz4','lz4hc'}))
+            if(ismember(zipmethod,{'zlib','gzip','lzma','lzip','lz4','lz4hc','base64'}))
                 decompfun=str2func([zipmethod 'decode']);
                 arraytype=data(j).(N_('_ArrayType_'));
                 chartype=0;
@@ -131,7 +131,7 @@ function newdata=jdatadecode(data,varargin)
                     chartype=1;
                     arraytype='uint8';
                 end
-                if(needbase64)
+                if(needbase64 && strcmp(zipmethod,'base64')==0)
                     ndata=reshape(typecast(decompfun(base64decode(data(j).(N_('_ArrayZipData_')))),arraytype),dims);
                 else
                     ndata=reshape(typecast(decompfun(data(j).(N_('_ArrayZipData_'))),arraytype),dims);