How can i store a .mat file into a variable?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sam CP
el 21 de Mzo. de 2017
Comentada: Stephen23
el 22 de Abr. de 2020
i want get the syntax to store a .mat file into a variable.
0 comentarios
Respuesta aceptada
Walter Roberson
el 21 de Mzo. de 2017
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 comentarios
Kieran Graham
el 22 de Abr. de 2020
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
el 22 de Abr. de 2020
S = load(...);
All of your variables will be fields in the scalar structure S, and are trivial to access.
Más respuestas (0)
Ver también
Categorías
Más información sobre Test and Measurement en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!