implements caching for loading procedure of the .mat files