Read value from a text file and store into an array
Show older comments
I have a text file 'Busdata8.txt' which has data as follows:
%|Bus | Type | Vsp | theta | PGi | QGi | PLi | QLi | Qmin | Qmax | Transaction |
1 1 1.0 0 0 0 0 0 0 0 1
2 2 1.03 0 550 0 0 0 0 0 1
3 3 1.0 0 0 0 350 0 0 0 1
4 3 1.0 0 0 0 300 0 0 0 1
5 3 1.0 0 0 0 250 0 0 0 1
6 3 1.0 0 0 0 100 0 0 0 2
7 3 1.0 0 0 0 100 0 0 0 3
8 2 1.05 0 100 0 0 0 0 0 2
8 2 1.05 0 100 0 0 0 0 0 3
I want to skip the wordings in the first line and extract the numerical data into an array, something look like this:
Array = 1 1 1.0 0 0 0 0 0 0 0 1
2 2 1.03 0 550 0 0 0 0 0 1
3 3 1.0 0 0 350 0 0 0 0 1
4 3 1.0 0 0 300 0 0 0 0 1
5 3 1.0 0 0 250 0 0 0 0 1
6 3 1.0 0 0 100 0 0 0 0 2
7 3 1.0 0 0 100 0 0 0 0 3
8 2 1.05 0 100 0 0 0 0 0 2
8 2 1.05 0 100 0 0 0 0 0 3
Kindly help me out. Thanks in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Whos 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!