Collecting data, very specific lines, avoiding unecessay lines in between
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
Hello All,
I have a .txt file contains 894 lines, now I am interested to collect the line just below the STEP TYPE MEASURED RATE LIMIT RESULT line til end of file. There are 22 steps and I want to collect data from 1 to 22 and then save it in a new .txt file. How can I do it, any idea/comments will be very helpful?
'TEST ERROR SAMPLES ERROR ERROR INTERIM'
'STEP TYPE MEASURED RATE LIMIT RESULT'
'1 BCS ACK/NACK 2054 0.00000 10.0000 Inside'
'TEST ERROR SAMPLES ERROR ERROR INTERIM'
'STEP TYPE MEASURED RATE LIMIT RESULT'
'2 BCS ACK/NACK 2054 2.00000 10.0000 Inside'
.
.
.
.
'TEST ERROR SAMPLES ERROR ERROR INTERIM'
'STEP TYPE MEASURED RATE LIMIT RESULT'
'22 BCS ACK/NACK 2054 1.10000 10.0000 Inside'
Risposte (1)
Image Analyst
il 4 Ott 2012
0 voti
Just use fopen, fgetl, and fclose. Read the line with fgetl(). Then use strfind(). If you find 'TEST' or 'STEP', ignore that line. Then use textscan to get the data from the "good" line. Use fprintf() to write out the data to the new file.
1 Commento
MJ
il 4 Ott 2012
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!