How can I rearrange data in txt file to Matlab?

1 view (last 30 days)
Yang Yang
Yang Yang on 11 Feb 2019
Answered: KSSV on 12 Feb 2019
How to rrearrange the collected AP data into Matlab? Data of same address "7c:95:f3:00:8d:30" will in same column, and each row will show the data from same location 1 (0.0,0.0,0) .
1 (0.0,0.0,0)
7c:95:f3:00:8d:30 -65.67;
dc:a5:f4:4d:1a:50 -71.17;
78:4f:43:75:34:0c -72.83;
7c:95:f3:00:8d:31 -67.33;
70:69:5a:63:43:01 -67.50;
dc:a5:f4:4d:1a:51 -70.67;
dc:a5:f4:4d:1a:5e -75.33;
70:69:5a:63:43:00 -68.20;
70:69:5a:63:43:0f -69.80;
70:69:5a:63:43:0e -70.00;
2 (1.0,0.0,0)
7c:95:f3:00:8d:30 -66.17;
70:69:5a:63:43:0f -68.00;
dc:a5:f4:4d:1a:5f -75.50;
dc:a5:f4:4d:1a:50 -73.40;
00:c8:8b:9c:e3:80 -75.00;
70:69:5a:63:43:0e -68.17;
7c:95:f3:00:8d:31 -66.83;
dc:a5:f4:4d:1a:5e -75.83;
00:c8:8b:9c:e3:81 -74.00;
70:69:5a:63:43:01 -71.00;
3 (3.0,0.0,0)
7c:95:f3:00:8d:30 -69.83;
70:69:5a:63:43:0f -67.67;
dc:a5:f4:4d:1a:5f -74.67;
70:69:5a:63:43:0e -67.67;
7c:95:f3:00:8d:31 -68.50;
dc:a5:f4:4d:1a:5e -75.83;
dc:a5:f4:4d:1a:51 -73.00;
dc:a5:f4:4d:1a:50 -73.17;
70:69:5a:63:43:01 -69.00;
70:69:5a:63:43:00 -68.00;
4 (4.0,0.0,0)
7c:95:f3:00:8d:30 -69.33;
70:69:5a:63:43:0f -71.00;
78:4f:43:75:34:0c -75.83;
dc:a5:f4:4d:1a:5f -72.67;
70:69:5a:63:43:0e -71.17;
7c:95:f3:00:8d:31 -68.17;
dc:a5:f4:4d:1a:5e -72.17;
dc:a5:f4:4d:1a:51 -74.83;
dc:a5:f4:4d:1a:50 -74.83;
70:69:5a:63:43:01 -69.00;
70:69:5a:63:43:00 -69.60;
5 (0.0,1.0,0)
7c:95:f3:00:8d:30 -66.00;
70:69:5a:63:43:0f -66.50;
70:69:5a:63:43:0e -66.83;
7c:95:f3:00:8d:31 -64.50;
dc:a5:f4:4d:1a:51 -75.00;
dc:a5:f4:4d:1a:50 -74.33;
00:c8:8b:9c:e3:81 -74.50;
70:69:5a:63:43:00 -63.80;
00:c8:8b:9c:e3:80 -74.20;
70:69:5a:63:43:01 -63.00;
6 (1.0,1.0,0)
7c:95:f3:00:8d:30 -65.33;
70:69:5a:63:43:0f -69.83;
78:4f:43:75:34:0c -75.83;
dc:a5:f4:4d:1a:5f -76.00;
70:69:5a:63:43:0e -69.67;
7c:95:f3:00:8d:31 -63.33;
dc:a5:f4:4d:1a:51 -73.80;
dc:a5:f4:4d:1a:50 -73.40;
00:c8:8b:9c:e3:81 -74.00;
70:69:5a:63:43:00 -64.40;
00:c8:8b:9c:e3:80 -74.83;
70:69:5a:63:43:01 -63.40;
00:c8:8b:ab:c3:60 -74.50;
00:c8:8b:ab:c3:61 -75.00;

Answers (1)

KSSV
KSSV on 12 Feb 2019
fid = fopen('data.txt','rt') ;
S = textscan(fid,'%s','delimiter','\n') ;
S = S{1} ;
fclose(fid) ;
idx = contains(S,'7c:95:f3:00:8d:30') ;
iwant = S(idx)

Categories

Find more on Computational Fluid Dynamics (CFD) 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!