How can i store a .mat file into a variable?
조회 수: 2 (최근 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에서 Test and Measurement에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!