updated files to use matlab memory