more off

nt = 100
nx = 25
ny = 25

minstate = 2 
maxstate = 5
nstate = maxstate - minstate + 1

c = zeros(nx,ny,nt);
creal = zeros(nx,ny,nt);
cneg = zeros(nx,ny,nt);
c1 = zeros(nx,ny);
for it = 1 : nt
   c(:,:,it) = minstate + fix(nstate * rand(nx,ny));
   creal(:,:,it) = minstate + nstate * rand(nx,ny);
   cneg(:,:,it) = -(minstate + fix(nstate * rand(nx,ny)));
end
rgb = [[1.0 0.0 0.0]; [0.0 1.0 0.0]; [0.0 0.0 1.0]; [1.0 1.0 0.0]]
rgb1 = [[1.0 0.0 0.0]; [0.0 1.0 0.0]]
rgb2 = [[1.0 0.0 2.0]; [0.0 1.0 0.0]; [0.0 0.0 1.0]; [1.0 1.0 0.0]]
rgb3 = [[1.0 0.0 0.0]; [0.0 1.0 0.0]; [0.0 0.0 1.0]; [-1.0 1.0 0.0]]
rgb4 = [1.0 2.0 3.0]
rgb5 = [[1.0 0.0 0.0]; [0.0 1.0 0.0]; [0.0 0.0 1.0]; [1.0 1.0 0.0]; [1.0 1.0 1.0]]

disp('');
latout('lat.dat', creal, rgb);
disp('');
latout('lat.dat', cneg, rgb);
disp('');
latout('lat.dat', c, rgb1);
disp('');
latout('lat.dat', c, rgb2);
disp('');
latout('lat.dat', c, rgb3);
disp('');
latout('lat.dat', c, rgb4);
disp('');
latout(1, c1);
disp('lat.dat');
latout('lat.dat', c, rgb);
disp('lat0.dat');
latout('lat0.dat', c, rgb, 0);
disp('lat1.dat');
latout('lat1.dat', c, rgb, 1);
disp('lat5.dat');
latout('lat5.dat', c, rgb5, 5);
