Discussion:
Converting .m (script file) to .txt (text file)
(too old to reply)
William Sipprell
2009-07-14 16:52:03 UTC
Permalink
I have a bunch of .m files that need to be converted to .txt files. I want to be able to automate this to make the process easier, as there are many files that must be converted.

Is there any function in MATLAB that can help in this automation process?

Thank you
William
Rune Allnor
2009-07-14 16:58:17 UTC
Permalink
I have a bunch of .m files that need to be converted to .txt files. I want to be able to automate this to make the process easier, as there are many files that must be converted.  
Is there any function in MATLAB that can help in this automation process?
The .m files are text files at the outset, so
all you need to do is to copy the files, along
the lines of:

flist = dir('*.m');
for n=1:length(flist)
[fp,fn,fe] = fileparts(flist(n).name);
copyfile(flist(n).name,[fp,pathsep,fn,'.txt']);
end

Rune
William Sipprell
2009-07-14 17:12:05 UTC
Permalink
Thank you for the quick response Rune. That should solve the problem.

William
ABHINAV ASHISH
2017-02-23 04:41:04 UTC
Permalink
Post by Rune Allnor
I have a bunch of .m files that need to be converted to .txt files. I want to be able to automate this to make the process easier, as there are many files that must be converted.  
Is there any function in MATLAB that can help in this automation process?
The .m files are text files at the outset, so
all you need to do is to copy the files, along
flist = dir('*.m');
for n=1:length(flist)
[fp,fn,fe] = fileparts(flist(n).name);
copyfile(flist(n).name,[fp,pathsep,fn,'.txt']);
end
Run
I want to convert a signal saved in .m file to .txt file. It is not working.
If you can elaborate the above process then it would be helpful.
Nasser M. Abbasi
2017-02-23 06:24:16 UTC
Permalink
Post by ABHINAV ASHISH
I want to convert a signal saved in .m file to .txt file. It is not working.
If you can elaborate the above process then it would be helpful.
what do you mean by a "signal saved in .m file" ?

An .m file is a text file. There is nothing to covert.

It is not clear what you are asking.

Loading...