MATLAB: How can i store a .mat file into a variable

.mat filematrixreadstore

i want get the syntax to store a .mat file into a variable.

Best Answer

fid = fopen('YourMatFile.mat', 'r') ;
YourVariable = fread(fid, '*uint8').' ;
fclose(fid) ;
YourVariable is now a row vector of bytes that make up the mat file.
This kind of thing can be useful if you need to transmit a mat file over wireless or Ethernet, but otherwise has limited use.
.... But perhaps the answer you were looking for was just
YourVariable = load('YourMatFile.mat');