extracted cache decorator
saving results to mat file