Reading from a text file
Show older comments
I have data in a text file that looks like as follows:
A 736 575 493 669 517 514 519 Z
A 741 482 518 721 510 518 495 Z
A 746 540 518 696 541 521 480 Z
A 747 490 470 740 544 518 477 Z
748 468 522 674 502 517 465 Z
A 749 551 546 627 500 512 472 Z
A 750 454 521 653 538 503 474 Z
A 751 454 555 711 540 508 467 Z
A 752 615 551 740 532 508 482 Z
A 753 471 477 853 526 507 487 Z
As you can see the first four rows are the same where as the fifth is not. Is there any way I can only read the rows that are similar and neglect the rest? In addition, I would only like to read the columns 3,4,5,6,7,8. I tried using the following code but it give me an error I cannot figure out.
[a_x,a_y,a_z,pitch,roll,yaw]=textread('data3.txt','%*s %*d %d %d %d %d %d %d %*s','headerlines',1);
The error states that Trouble reading integer from file (row 698, field 8) ==> Z\n
I have, of course, not shown the entire data. Your help would be greatly appreciated. Thank you
Accepted Answer
More Answers (1)
Usman Azher
on 27 Apr 2011
0 votes
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!