Fixed reversed orientation checking bug; saved flattened samples to .mat files.