Borrar filtros
Borrar filtros

converting .m file to .mat

73 visualizaciones (últimos 30 días)
davit petraasya
davit petraasya el 6 de Mzo. de 2017
Comentada: Prabhakaran thirugnanam el 19 de Feb. de 2021
Hi
Does anyone knows how to convert .m file to .mat file. Please find my attached file below!
Thanks for your time!
  7 comentarios
Santhosh
Santhosh el 5 de Jul. de 2017
Thanks for the answer... It works good
Prabhakaran thirugnanam
Prabhakaran thirugnanam el 19 de Feb. de 2021
save('GDF_Lacq_bottomhole_pressure.mat') might save the mat file along with other variables which are available at the place where the line is placed. So it's better to create a simple function as below.
NOTE: M_File_Path and Mat_File_Path should be the whole path.(i.e. 'C:/users/......./xxx.m')
function Create_Mat_Out_Of_M_File(M_File_Path,Mat_File_Path)
run(M_File_Path);
clear M_File_Path;
save(Mat_File_Path);
end

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 6 de Mzo. de 2017
Editada: Jan el 6 de Mzo. de 2017
There is no need to include the variables in square brackets. Replace:
[d] = struct();
by
d = struct();
an so on.
These line will write something to the commabnd window (square brackets removed already):
CRS = 'n/a'%['EPSG:' num2str(input('[CRS] EPSG code (just number) = '))];
TimeZone = 'UTC' %input('TimeZone (char) = ');
Description = 'Lacq field: bottomhole pressure' %input('Description of data (char) = ');
If this is not wanted, insert semicolons:
CRS = 'n/a'; %['EPSG:' num2str(input('[CRS] EPSG code (just number) = '))];
... etc.
Then running your code creates the MAT file in the current folder. Perhaps you should set this accordingly by:
cd(tempdir)
% Or
% cd('C:\myData\Folder\');
  1 comentario
davit petraasya
davit petraasya el 7 de Mzo. de 2017
Thanks Simon,for the full explanation! It is helpful

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Standard File Formats 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!

Translated by