formating csv file for quick access of list of integers
I want to read in lists of integers in OML. I figured that I might use a csv-file for it.
The data is organized in set ids and contains a varying number of integers, for exampe a set id 100 could be
set 100 = 1 20 30 44 500 1234
and maybe set 556 could be
set 556 = 12000 33456 120000 140000 160000
I am still rather free how the data is written into csv-file as I am writing from a Tcl-routine running in Hyperview/Hypermesh, so I could be like:
100 556
1 12000
20 33456
30 120000
44 140000
500 160000
1234
first row would be defining the set id and the rows below in the same column define then the ids belonging into the set. However this is a little bit tedious to write from tcl, it would be easier if I transposed it, but the problem might be then the line length as the number of ids can be rather high. I could write one set
over multiple lines:
100 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
100 | 9 | 10 | 11 | 12 | 13 | ||||
200 | 22 | 25 | 26 | 27 | |||||
300 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
300 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | |
300 | 47 | 48 | 49 | 50 |
Here set id 100 would be over two lines, set 200 needs only one line and 300 would be over 3 lines. I would then only need to concate the lists together, but I am not sure how to accomplish that in oml.
Can somebody give me a tip for a handy one-liner, I tend to think the last csv-format would be easiest to write from tcl but how do I combine the id lists from successive lines, in the end I might prefer to have something like:
set(100) = [1;2;3;4;5;6;7;8;9;10;11;12;13]