%% Used to generate grids to write to images function[grid] = blockGeneration(current, next, zoomFactor) %% grid - Output to write to image %% current - Current stop %% next - Next Stop %% ZoomFactor - 7*zoomFactor is size of image side grid = zeros(7); grid(9:13) = decode('TOP') - 48; grid(16:20) = decode(current) - 48; grid(23:27) = decode(next) - 48; grid(30:34) = bitxor(grid(16:20), grid(23:27)); grid(37:41) = decode('BOT') - 48; grid = transpose(grid); grid = imresize(grid, zoomFactor, 'nearest'); imwrite(grid, strcat('blockImages/', current, next, '.png')); % A = 00001 ... Z = 11010, TOP = 11011, BOTTOM = 11100, END = 11101 function [binRep] = decode(charRep) if (charRep == 'END') binRep = '11101'; elseif (charRep == 'TOP') binRep = '11011'; elseif (charRep == 'BOT') binRep = '11100'; else val = double(charRep) - 64; binRep = dec2bin(val, 5); end