Hi
Does anyone knows how to convert .m file to .mat file. Please find my attached file below!
Thanks for your time!

댓글 수: 7

KSSV
KSSV 2017년 3월 6일
The code you gave generates a .mat file. What you are expecting?
davit petraasya
davit petraasya 2017년 3월 6일
Hi KSSV,yeah, I am supposed to get .mat file by this code. But it is giving .m output. Is not it?
davit petraasya
davit petraasya 2017년 3월 6일
I don't know why I am getting .m type file.
KSSV
KSSV 2017년 3월 6일
The last line of the code:
save('GDF_Lacq_bottomhole_pressure.mat')
clearly says, to save the data in .mat file. You will get the .mat file.
davit petraasya
davit petraasya 2017년 3월 6일
Cool, thanks!
Santhosh
Santhosh 2017년 7월 5일
Thanks for the answer... It works good
Prabhakaran thirugnanam
Prabhakaran thirugnanam 2021년 2월 19일
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

댓글을 달려면 로그인하십시오.

 채택된 답변

Jan
Jan 2017년 3월 6일
편집: Jan 2017년 3월 6일

1 개 추천

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

davit petraasya
davit petraasya 2017년 3월 7일
Thanks Simon,for the full explanation! It is helpful

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Time Series Objects에 대해 자세히 알아보기

질문:

2017년 3월 6일

댓글:

2021년 2월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by