|
110 | 110 | for j=1:len
|
111 | 111 | if(isfield(data,N_('_ArrayZipSize_')) && isfield(data,N_('_ArrayZipData_')))
|
112 | 112 | zipmethod='zip';
|
| 113 | + dims=data(j).(N_('_ArrayZipSize_'))(:)'; |
| 114 | + if(length(dims)==1) |
| 115 | + dims=[1 dims]; |
| 116 | + end |
113 | 117 | if(isfield(data,N_('_ArrayZipType_')))
|
114 | 118 | zipmethod=data(j).(N_('_ArrayZipType_'));
|
115 | 119 | end
|
116 | 120 | if(~isempty(strmatch(zipmethod,{'zlib','gzip','lzma','lzip','lz4','lz4hc'})))
|
117 | 121 | decompfun=str2func([zipmethod 'decode']);
|
118 | 122 | if(needbase64)
|
119 |
| - ndata=reshape(typecast(decompfun(base64decode(data(j).(N_('_ArrayZipData_')))),data(j).(N_('_ArrayType_'))),data(j).(N_('_ArrayZipSize_'))(:)'); |
| 123 | + ndata=reshape(typecast(decompfun(base64decode(data(j).(N_('_ArrayZipData_')))),data(j).(N_('_ArrayType_'))),dims); |
120 | 124 | else
|
121 |
| - ndata=reshape(typecast(decompfun(data(j).(N_('_ArrayZipData_'))),data(j).(N_('_ArrayType_'))),data(j).(N_('_ArrayZipSize_'))(:)'); |
| 125 | + ndata=reshape(typecast(decompfun(data(j).(N_('_ArrayZipData_'))),data(j).(N_('_ArrayType_'))),dims); |
122 | 126 | end
|
123 | 127 | else
|
124 | 128 | error('compression method is not supported');
|
|
130 | 134 | ndata=cast(data(j).(N_('_ArrayData_')),char(data(j).(N_('_ArrayType_'))));
|
131 | 135 | end
|
132 | 136 | if(isfield(data,N_('_ArrayZipSize_')))
|
133 |
| - ndata=reshape(ndata(:),fliplr(data(j).(N_('_ArrayZipSize_'))(:)')); |
| 137 | + dims=data(j).(N_('_ArrayZipSize_'))(:)'; |
| 138 | + if(length(dims)==1) |
| 139 | + dims=[1 dims]; |
| 140 | + end |
| 141 | + ndata=reshape(ndata(:),fliplr(dims)); |
134 | 142 | ndata=permute(ndata,ndims(ndata):-1:1);
|
135 | 143 | end
|
136 | 144 | iscpx=0;
|
|
142 | 150 | if(isfield(data,N_('_ArrayIsSparse_')) && data(j).(N_('_ArrayIsSparse_')))
|
143 | 151 | if(isfield(data,N_('_ArraySize_')))
|
144 | 152 | dim=double(data(j).(N_('_ArraySize_'))(:)');
|
| 153 | + if(length(dim)==1) |
| 154 | + dim=[1 dim]; |
| 155 | + end |
145 | 156 | if(iscpx)
|
146 | 157 | ndata(end-1,:)=complex(ndata(end-1,:),ndata(end,:));
|
147 | 158 | end
|
|
172 | 183 | data(j).(N_('_ArraySize_'))=data(j).(N_('_ArraySize_'))(end:-1:1);
|
173 | 184 | end
|
174 | 185 | dims=data(j).(N_('_ArraySize_'))(:)';
|
| 186 | + if(length(dims)==1) |
| 187 | + dims=[1 dims]; |
| 188 | + end |
175 | 189 | ndata=reshape(ndata(:),dims(:)');
|
176 | 190 | if(format>1.9)
|
177 | 191 | ndata=permute(ndata,ndims(ndata):-1:1);
|
|
0 commit comments