Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

To read a specified data from text file

Status
Not open for further replies.

murari208@gmail.com

Newbie level 3
Newbie level 3
Joined
Jan 1, 2015
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
19
hi all,
there is a text file containing some data like number of samples , time ,x0...
i need to read only times of the sample and write it in a text file since i am taking large number of samples .can you please help me in solving this.
 

This is called parsing a file. First of all you must work out the format of the incoming file. Is it CSV (comma separated variables), is the data of fixed format? Once you have sorted this sort of thing, then you could import it into a database programme and export the wanted columns as a CSV file.
We once had to take the printer output of an instrument and pull out the numbers to telemeter back to a control station. Because of the total non standard format we had a programme written in C to trawl through the file, just looking for the numbers and ignoring everything else.
Frank
 

first of all thanks for your response.. i am attaching the zip file .. which has LVM file in it. the timings in this file has to be taken out. can i do it in matlab by reading the data or is there any other solution.
 

Attachments

  • digi_trig_1.zip
    2.3 KB · Views: 100

See my perl program in your other duplicate thread.

This is one of the primary reasons I learned perl in the first place. It's a real pain to use some database program or excel or other ridiculous software package or even a C program to build some one-off quick dirty file parser.

Instead just write some perl (or any other "script language") and wam-bam you're done (before your C compiler has finished linking).

- - - Updated - - -

Gee, just took a look at your file. My perl program needs to be modified to look for the Time string.

Use..

Code Perl - [expand]
1
if ( $line =~ m/^Time\t(\d{2}\:\d{2}\:\d{2}\.\d{1,})/ ) {print "$1\n"}


inside the while loop instead of what I posted in your other thread.

change the {1,} if you want to truncate to a specific number of digits like i.e. {4} for four digits after the decimal point.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top