|
75 | 75 | % compress a long string, one must convert |
76 | 76 | % it to uint8 or int8 array first. The compressed |
77 | 77 | % array uses three extra fields |
78 | | -% "_ArrayCompressionMethod_": the opt.Compression value. |
79 | | -% "_ArrayCompressionSize_": a 1D interger array to |
| 78 | +% "_ArrayZipType_": the opt.Compression value. |
| 79 | +% "_ArrayZipSize_": a 1D interger array to |
80 | 80 | % store the pre-compressed (but post-processed) |
81 | 81 | % array dimensions, and |
82 | | -% "_ArrayCompressedData_": the "base64" encoded |
| 82 | +% "_ArrayZipData_": the "base64" encoded |
83 | 83 | % compressed binary array data. |
84 | 84 | % opt.CompressArraySize [100|int]: only to compress an array if the total |
85 | 85 | % element count is larger than this number. |
|
534 | 534 | % General case, store row and column indices. |
535 | 535 | fulldata=[ix,iy,data]; |
536 | 536 | end |
537 | | - txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep); |
538 | | - txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionMethod_": "',dozip, ['"' sep]); |
| 537 | + txt=sprintf(dataformat,txt,padding0,'"_ArrayZipSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep); |
| 538 | + txt=sprintf(dataformat,txt,padding0,'"_ArrayZipType_": "',dozip, ['"' sep]); |
539 | 539 | compfun=str2func([dozip 'encode']); |
540 | | - txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressedData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]); |
| 540 | + txt=sprintf(dataformat,txt,padding0,'"_ArrayZipData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]); |
541 | 541 | else |
542 | 542 | if(size(item,1)==1) |
543 | 543 | % Row vector, store only column indices. |
|
566 | 566 | txt=sprintf(dataformat,txt,padding0,'"_ArrayIsComplex_": ','true', sep); |
567 | 567 | fulldata=[real(item(:)) imag(item(:))]'; |
568 | 568 | end |
569 | | - txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep); |
570 | | - txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressionMethod_": "',dozip, ['"' sep]); |
| 569 | + txt=sprintf(dataformat,txt,padding0,'"_ArrayZipSize_": ',regexprep(mat2str(size(fulldata)),'\s+',','), sep); |
| 570 | + txt=sprintf(dataformat,txt,padding0,'"_ArrayZipType_": "',dozip, ['"' sep]); |
571 | 571 | compfun=str2func([dozip 'encode']); |
572 | | - txt=sprintf(dataformat,txt,padding0,'"_ArrayCompressedData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]); |
| 572 | + txt=sprintf(dataformat,txt,padding0,'"_ArrayZipData_": "',base64encode(compfun(typecast(fulldata(:),'uint8'))),['"' nl]); |
573 | 573 | else |
574 | 574 | if(isreal(item)) |
575 | 575 | txt=sprintf(dataformat,txt,padding0,'"_ArrayData_": ',... |
|
0 commit comments