diff options
author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
---|---|---|
committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/toolbox/toolbox_basic/io/readlines.m | |
parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/io/readlines.m')
-rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/io/readlines.m | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/io/readlines.m b/SD-VBS/common/toolbox/toolbox_basic/io/readlines.m new file mode 100755 index 0000000..90bc944 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/io/readlines.m | |||
@@ -0,0 +1,30 @@ | |||
1 | function [lines,indexes] = readlines(fname) | ||
2 | % | ||
3 | % [lines,indexes] = readlines(fname) | ||
4 | % Read Edges points from .Ins file produced by "getlines" | ||
5 | % lines: a num_pointsx2 matrix of the edge points | ||
6 | % indexes: the braking point the lines | ||
7 | % | ||
8 | |||
9 | fid = fopen(fname,'r'); | ||
10 | |||
11 | done = 0; | ||
12 | lines = []; | ||
13 | indexes = []; | ||
14 | |||
15 | first_line = fscanf(fid,'%s',1); | ||
16 | |||
17 | while (~done), | ||
18 | num_lines = sscanf(first_line(3:length(first_line)),'%d'); | ||
19 | disp(num_lines); | ||
20 | indexes = [indexes,num_lines]; | ||
21 | a = fscanf(fid,'%f',[2,num_lines]); | ||
22 | lines = [lines;a']; | ||
23 | |||
24 | first_line = fscanf(fid,'%s',1); | ||
25 | if (first_line == []), | ||
26 | done = 1; | ||
27 | end | ||
28 | end | ||
29 | |||
30 | |||