After some tests I have the impression that:
fwrite(fid, A, '512*int16', 20)
inserts the 20 bytes for skipping before the blocks, while:
fread(fid, 512*N, '512*int16=>int16', 20)
skips the 20 bytes behind the block. Where do you want the skipping bytes? If before the data blocks is wanted, modify the reading like this:
fread(fid, 20, 'int8'); % Skip manually at first
fread(fid, 512*N, '512*int16=>int16', 20)