File: demo_zmat_basic.m

package info (click to toggle)
zmat 0.9.8%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 812 kB
  • sloc: ansic: 9,400; makefile: 185; cpp: 104; sh: 101; f90: 64
file content (25 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% addpath('../')

% compression
[dzip,info]=zmat(uint8(eye(5,5)))

% decompression
orig=reshape(zmat(dzip,0),info.size)

% base64 encoding and decoding
base64=zmat('zmat toolbox',1,'base64');
char(base64)

orig=zmat(base64,0,'base64');
char(orig)

% encode ND numeric array
orig=single(rand(5));
[Aencoded,info]=zmat(orig,1,'lzma')

% decode compressed ND array and restore size/type
Adecoded=zmat(Aencoded,info)

all(all(Adecoded==orig))
class(Adecoded)