| MATLAB Central > MATLAB Newsreader > How to remove unwanted text from a .txt file? |
|
|
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 23 Sep, 2008 22:35:03 Message: 1 of 20 |
|
HI, |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 23 Sep, 2008 22:58:01 Message: 2 of 20 |
|
I use textscan to read the dat and when the text is found contrary to the field setup as per the %f etc. then textscan does not continue to load the file and worst is that it does not warn one. So I guess by checking the input matrix size utilizing a timer one could guess that there is the text present in the file at which time would be nice to be able to remove the unwanted txt lines but HOW? |
|
Subject: How to remove unwanted text from a .txt file? From: Walter Roberson Date: 23 Sep, 2008 23:01:24 Message: 3 of 20 |
|
Cy abd wrote: |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 23 Sep, 2008 23:33:01 Message: 4 of 20 |
|
how about just the matlab way, since I'm posting in the matlab forum? care to maybe hint on that? |
|
Subject: How to remove unwanted text from a .txt file? From: Walter Roberson Date: 24 Sep, 2008 00:18:42 Message: 5 of 20 |
|
Cy abd top-posted: |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 24 Sep, 2008 00:35:03 Message: 6 of 20 |
|
Walter Roberson <roberson@hushmail.com> wrote in message <VGfCk.562$Cl1.66@newsfe01.iad>... |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 24 Sep, 2008 00:47:02 Message: 7 of 20 |
|
|
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 24 Sep, 2008 01:19:02 Message: 8 of 20 |
|
"Cy abd" <gringoven@gmail.com> wrote in message <gbc2m6$de7$1@fred.mathworks.com>... |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 24 Sep, 2008 05:31:01 Message: 9 of 20 |
|
The following code does what I need to do but is very slow since the .txt file is about 500,000 lines and the 3rd. line after else takes up 85% of the total time! How can that line be optimized please? |
|
Subject: How to remove unwanted text from a .txt file? From: Walter Roberson Date: 24 Sep, 2008 05:46:45 Message: 10 of 20 |
|
Cy abd wrote: |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 24 Sep, 2008 06:36:02 Message: 11 of 20 |
|
Thank you so very much, the code is a lot more efficient now, although the B(r,:) = [A{:}]; line is accounting for 96% of the time consumed. It is amazing how efficient textscan is at only 4.%! |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 24 Sep, 2008 06:48:01 Message: 12 of 20 |
|
Couldn't find the "How to create a variable array n*2" thread! |
|
Subject: How to remove unwanted text from a .txt file? From: Walter Roberson Date: 24 Sep, 2008 07:10:40 Message: 13 of 20 |
|
Cy abd wrote: |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 26 Sep, 2008 02:27:01 Message: 14 of 20 |
|
Walter Roberson <roberson@hushmail.com> wrote in message <5JlCk.9617$tp1.8665@newsfe06.iad>... |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 26 Sep, 2008 03:11:02 Message: 15 of 20 |
|
I seem to have found a reasonable solution to my problem but however I can’t get it to work, Will appreciate reviewing my code below please. |
|
Subject: How to remove unwanted text from a .txt file? From: Walter Roberson Date: 26 Sep, 2008 06:19:05 Message: 16 of 20 |
|
Cy abd wrote: |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 26 Sep, 2008 07:06:02 Message: 17 of 20 |
|
Mr. Robertson, |
|
Subject: How to remove unwanted text from a .txt file? From: Andres Date: 26 Sep, 2008 07:09:02 Message: 18 of 20 |
|
"Cy abd" <gringoven@gmail.com> wrote in message <gbhjs6$nr8$1@fred.mathworks.com>... |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 26 Sep, 2008 20:03:02 Message: 19 of 20 |
|
163,300 lines of a 3.8 Meg file cleaned of Elapsed time is 0.857841 seconds. with 40 lines of text and blank lines including all of this post in 0.857841 seconds! Elegantly and using only the power of textscan! |
|
Subject: How to remove unwanted text from a .txt file? From: Cy abd Date: 27 Sep, 2008 07:11:01 Message: 20 of 20 |
|
Replacing the line: |
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.
| Tag Activity for This Thread | ||
|---|---|---|
| Tag | Applied By | Date/Time |
| textscan textfile | Cy abd | 26 Sep, 2008 16:05:07 |
| allocation | Andres | 26 Sep, 2008 09:47:13 |
| textscan | Andres | 26 Sep, 2008 09:47:02 |
| allocation | nor ki | 24 Sep, 2008 02:51:08 |
