FIXED-TERM Nacer Mohamed Ikbal (ETAS/ESY)
2018-10-25 13:53:02 UTC
Hi,
I have a simple task to split a element of a matrix into rows where remaining columns are duplicated. I have achieved that with loops.
I am sure there is an efficient way to do it using matrix functions. Can you please help?
The data contains both numbers and strings
the column 6 and 7 has equal numbers of elements delimited by '~'
Given Matrix
1 2 3 4 5 a~b~c~d 111~222~333~444
4 5 6 7 6 e~f~g~h~i 555~666~777~888~999
8 9 10 11 12 j~k~l~m 112~223~334~445
.........
.........
Output after processing
1 2 3 4 5 a 111
1 2 3 4 5 b 222
1 2 3 4 5 c 333
1 2 3 4 5 d 444
4 5 6 7 6 e 555
4 5 6 7 6 f 666
4 5 6 7 6 g 777
4 5 6 7 6 h 888
4 5 6 7 6 i 999
8 9 10 11 12 j 112
8 9 10 11 12 k 223
8 9 10 11 12 l 334
8 9 10 11 12 m 445
..........
..........
Mit freundlichen Grüßen / Best regards
Mohamed Ikbal Nacer
Engineering of Systems (ETAS/ESY)
Tel. +49 711 3423-0 | Fax +49 711 3423-300 | fixed-***@etas.com<mailto:fixed-***@etas.com>
I have a simple task to split a element of a matrix into rows where remaining columns are duplicated. I have achieved that with loops.
I am sure there is an efficient way to do it using matrix functions. Can you please help?
The data contains both numbers and strings
the column 6 and 7 has equal numbers of elements delimited by '~'
Given Matrix
1 2 3 4 5 a~b~c~d 111~222~333~444
4 5 6 7 6 e~f~g~h~i 555~666~777~888~999
8 9 10 11 12 j~k~l~m 112~223~334~445
.........
.........
Output after processing
1 2 3 4 5 a 111
1 2 3 4 5 b 222
1 2 3 4 5 c 333
1 2 3 4 5 d 444
4 5 6 7 6 e 555
4 5 6 7 6 f 666
4 5 6 7 6 g 777
4 5 6 7 6 h 888
4 5 6 7 6 i 999
8 9 10 11 12 j 112
8 9 10 11 12 k 223
8 9 10 11 12 l 334
8 9 10 11 12 m 445
..........
..........
Mit freundlichen Grüßen / Best regards
Mohamed Ikbal Nacer
Engineering of Systems (ETAS/ESY)
Tel. +49 711 3423-0 | Fax +49 711 3423-300 | fixed-***@etas.com<mailto:fixed-***@etas.com>