Thread Subject:
read edit save a text in a loop

Subject: read edit save a text in a loop

From: maryam

Date: 24 Jun, 2012 07:27:09

Message: 1 of 7

Hi,

I could not find any straightforward Commands to ''Read, Edit (find, replace, remove) & Save'' a text file(e.g. in a loop in the m.files ).
i just see some discussions about this in mathwork.
Does any one know if there is any Especial Way / Command for this purpose?

Best regards,
Maryam

Subject: read edit save a text in a loop

From: TideMan

Date: 24 Jun, 2012 10:58:07

Message: 2 of 7

On Sunday, June 24, 2012 7:27:09 PM UTC+12, maryam wrote:
> Hi,
>
> I could not find any straightforward Commands to ''Read, Edit (find, replace, remove) & Save'' a text file(e.g. in a loop in the m.files ).
> i just see some discussions about this in mathwork.
> Does any one know if there is any Especial Way / Command for this purpose?
>
> Best regards,
> Maryam

Why would you use Matlab for this?
Surely Wordpad or Notepad or similar would be more appropriate?
Matlab stands for Matrix Laboratory, in other words numerical algebra.
What you're looking for is a text editor.
It's like using a nutcracker to open an oyster, sure you can do that, by would you?

Subject: read edit save a text in a loop

From: maryam

Date: 24 Jun, 2012 14:57:07

Message: 3 of 7

You Are Absolutely right.
But when I have to this for 100 files , then it goes on my Nerves doing the same thing for hour which could be done by a loop in matlab.
I want to delet headers , footers , and replace all Commas with dot, for 100 of data files once in week for data analyzig


TideMan <mulgor@gmail.com> wrote in message <f0f1c186-a9da-433a-a6b4-ce44c6dad2b9@googlegroups.com>...
> On Sunday, June 24, 2012 7:27:09 PM UTC+12, maryam wrote:
> > Hi,
> >
> > I could not find any straightforward Commands to ''Read, Edit (find, replace, remove) & Save'' a text file(e.g. in a loop in the m.files ).
> > i just see some discussions about this in mathwork.
> > Does any one know if there is any Especial Way / Command for this purpose?
> >
> > Best regards,
> > Maryam
>
> Why would you use Matlab for this?
> Surely Wordpad or Notepad or similar would be more appropriate?
> Matlab stands for Matrix Laboratory, in other words numerical algebra.
> What you're looking for is a text editor.
> It's like using a nutcracker to open an oyster, sure you can do that, by would you?

Subject: read edit save a text in a loop

From: maryam

Date: 24 Jun, 2012 15:00:08

Message: 4 of 7


I found this Function:

http://www.mathworks.com/matlabcentral/fileexchange/18909-replace-strings-in-text-file/content/replaceinfile.m

but I did not try it yet , I am not sure if it works.




TideMan <mulgor@gmail.com> wrote in message <f0f1c186-a9da-433a-a6b4-ce44c6dad2b9@googlegroups.com>...
> On Sunday, June 24, 2012 7:27:09 PM UTC+12, maryam wrote:
> > Hi,
> >
> > I could not find any straightforward Commands to ''Read, Edit (find, replace, remove) & Save'' a text file(e.g. in a loop in the m.files ).
> > i just see some discussions about this in mathwork.
> > Does any one know if there is any Especial Way / Command for this purpose?
> >
> > Best regards,
> > Maryam
>
> Why would you use Matlab for this?
> Surely Wordpad or Notepad or similar would be more appropriate?
> Matlab stands for Matrix Laboratory, in other words numerical algebra.
> What you're looking for is a text editor.
> It's like using a nutcracker to open an oyster, sure you can do that, by would you?

Subject: read edit save a text in a loop

From: dpb

Date: 24 Jun, 2012 15:03:57

Message: 5 of 7

On 6/24/2012 9:57 AM, maryam wrote:
> You Are Absolutely right.
> But when I have to this for 100 files , then it goes on my Nerves doing
> the same thing for hour which could be done by a loop in matlab.
> I want to delet headers , footers , and replace all Commas with dot, for
> 100 of data files once in week for data analyzig
...

Either write a script or function to do it in Matlab or find and use
another editing tool that has batch edit capabilities--there is an
almost innumerable veritable plethora of them around...

--

Subject: read edit save a text in a loop

From: Nasser M. Abbasi

Date: 24 Jun, 2012 15:13:39

Message: 6 of 7

On 6/24/2012 9:57 AM, maryam wrote:
> You Are Absolutely right.
> But when I have to this for 100 files , then it goes on my Nerves doing the same thing for hour


Never heared of bash?

---------------------------
#!/bin/bash

FILES="$@"
for f in $FILES
do
    vi ${f}
done
--------------------------

If you do not have linux, install VBox (free) and
install Linux (free)

--Nasser

Subject: read edit save a text in a loop

From: maryam

Date: 24 Jun, 2012 16:03:07

Message: 7 of 7

well ,
it works:
fnames={'h000v055.txt' ,......}; % name of the files
nf=size(fnames,2);
for i=nf
 [s, msg] = replaceinfile(',', '.', char(fnames(i)),'-nobak');
end



"maryam " <m.zeinalzadeh@gmail.com> wrote in message <js79s3$9t4$1@newscl01ah.mathworks.com>...
> You Are Absolutely right.
> But when I have to this for 100 files , then it goes on my Nerves doing the same thing for hour which could be done by a loop in matlab.
> I want to delet headers , footers , and replace all Commas with dot, for 100 of data files once in week for data analyzig
>
>
> TideMan <mulgor@gmail.com> wrote in message <f0f1c186-a9da-433a-a6b4-ce44c6dad2b9@googlegroups.com>...
> > On Sunday, June 24, 2012 7:27:09 PM UTC+12, maryam wrote:
> > > Hi,
> > >
> > > I could not find any straightforward Commands to ''Read, Edit (find, replace, remove) & Save'' a text file(e.g. in a loop in the m.files ).
> > > i just see some discussions about this in mathwork.
> > > Does any one know if there is any Especial Way / Command for this purpose?
> > >
> > > Best regards,
> > > Maryam
> >
> > Why would you use Matlab for this?
> > Surely Wordpad or Notepad or similar would be more appropriate?
> > Matlab stands for Matrix Laboratory, in other words numerical algebra.
> > What you're looking for is a text editor.
> > It's like using a nutcracker to open an oyster, sure you can do that, by would you?

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us