How can i store a .mat file into a variable?
1 次查看(过去 30 天)
显示 更早的评论
i want get the syntax to store a .mat file into a variable.
0 个评论
采纳的回答
Walter Roberson
2017-3-21
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');
4 个评论
Kieran Graham
2020-4-22
Hi, I am also having a similar problem. I have 23 variables stored in my temp.mat file. Is it possible to use these values by simply using load('temp.mat', 'variable1', 'variable2', ....) or will I need to recover the values 1 by 1?
Thanks
Stephen23
2020-4-22
S = load(...);
All of your variables will be fields in the scalar structure S, and are trivial to access.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!