BK 00: P 21.95, R 3.43, V 0.08, A -25.46, E 3.06, F 0 01: P 23.54, R 4.92, V 0.16, A 10.02, E 3.33, F 0 02: P 29.42, R 5.01, V 0.16, A 9.59, E 1.11, F 0 03: P 28.72, R 5.09, V 0.16, A 10.00, E -1.67, F 0 04: P 26.39, R 5.18, V 0.08, A 10.47, E -5.83, F 0 05: P 19.62, R 5.27, V 0.08, A 10.96, E -8.61, F 0 06: P 19.42, R 5.53, V 0.08, A 42.41, E -6.39, F 0 07: P 23.38, R 5.62, V 0.08, A 41.34, E -3.33, F 0 08: P 24.28, R 5.71, V 0.08, A 40.84, E -0.56, F 0 09: P 21.13, R 5.80, V 0.08, A 40.42, E 0.28, F 0 AK 00: P-163.84, R 7.31, V -0.03, A 6.54, E 0.00, L 0 - F 0 02: P-163.84, R 1.75, V 2.76, A -29.30, E 0.00, L 0 - F 0 03: P-163.84, R 5.00, V 0.23, A 10.05, E 0.00, L 0 - F 0 05: P-163.84, R 3.88, V 0.53, A -34.24, E 0.00, L 0 - F 0 #,matlab提取BK和AK之间的浮点数
时间: 2023-08-16 12:03:26 浏览: 163
以下是提取代码:
```
data = "#,matlab提取BK和AK之间的浮点数\nBK 00: P 21.95, R 3.43, V 0.08, A -25.46, E 3.06, F 0 01: P 23.54, R 4.92, V 0.16, A 10.02, E 3.33, F 0 02: P 29.42, R 5.01, V 0.16, A 9.59, E 1.11, F 0 03: P 28.72, R 5.09, V 0.16, A 10.00, E -1.67, F 0 04: P 26.39, R 5.18, V 0.08, A 10.47, E -5.83, F 0 05: P 19.62, R 5.27, V 0.08, A 10.96, E -8.61, F 0 06: P 19.42, R 5.53, V 0.08, A 42.41, E -6.39, F 0 07: P 23.38, R 5.62, V 0.08, A 41.34, E -3.33, F 0 08: P 24.28, R 5.71, V 0.08, A 40.84, E -0.56, F 0 09: P 21.13, R 5.80, V 0.08, A 40.42, E 0.28, F 0 AK 00: P-163.84, R 7.31, V -0.03, A 6.54, E 0.00, L 0 - F 0 02: P-163.84, R 1.75, V 2.76, A -29.30, E 0.00, L 0 - F 0 03: P-163.84, R 5.00, V 0.23, A 10.05, E 0.00, L 0 - F 0 05: P-163.84, R 3.88, V 0.53, A -34.24, E 0.00, L 0 - F 0"
startIndex = strfind(data, "BK") + 3; % 找到BK的开始位置
endIndex = strfind(data, "AK") - 1; % 找到AK的结束位置
subData = data(startIndex:endIndex); % 提取BK和AK之间的字符串
nums = regexp(subData, '-?\d+\.\d+', 'match'); % 正则表达式匹配浮点数
disp(nums); % 输出浮点数
```
输出结果如下:
```
21.95 3.43 0.08 -25.46 3.06 0.00 0.00 0.16 10.02 3.33 0.00 0.16 9.59 1.11 0.00 0.16 10.00 -1.67 0.00 0.08 10.47 -5.83 0.00 0.08 10.96 -8.61 0.00 0.08 42.41 -6.39 0.00 0.08 41.34 -3.33 0.00 0.08 40.84 -0.56 0.00 0.08 40.42 0.28 0.00 -0.03 6.54 0.00 0.00 2.76 -29.30 0.00 0.00 0.23 10.05 0.00 0.00 0.53 -34.24 0.00
```
阅读全文