kideas
Junior Member
Posts: 69
|
Post by kideas on Nov 26, 2018 14:27:54 GMT
Hi, I've successfully built my script and is running as expected but I need some help with some array manipulation: so I have this code table = {0,0,0,1,1,0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,0,1,0,1,1,0,0,1,1} so I want to extract the values from key 1 to n to a new table with a condition: The values are 6 rows in a column; the reading is done row by row from column 1 to column n. so if the current column have all rows being 1 then it should skip to the 6th row of the next column to check if it is also 1; if true then it that particular row should come after the 6th row of the current column; it will then then check the next 6th row of the next column again if it's 1 and repeat the previous until false; Then it will come back to continue from the first row of the column next to the column with 1,1,1,1,1,1. It will continue from row 1 to row 5 excluding the 6th row since it has been dealt with already and it continues like that excluding the 6th values already recorded Please help very urgent
|
|
|
Post by AnkuLua on Nov 26, 2018 14:36:05 GMT
You example table have only one row. Please specify your example. It's also better to have example result that you want.
|
|
kideas
Junior Member
Posts: 69
|
Post by kideas on Nov 26, 2018 14:52:45 GMT
thanks for the response: here's the details
table A = {0,0,0,8,8,8} table B = {1,1,1,1,1,1} table C = {0,0,8,8,8,1} table D = {0,0,0,8,8,1} table E = {0,8,8,8,8,8}
so in concatenating all the values in the tables this is the expected results:
results = {0,0,0,8,8,8,1,1,1,1,1,1,1,1,0,0,8,8,8,0,0,0,8,8,0,8,8,8,8,8}
thanks
|
|
kideas
Junior Member
Posts: 69
|
Post by kideas on Nov 26, 2018 14:53:11 GMT
i hope it's clear now
|
|
|
Post by AnkuLua on Nov 26, 2018 15:11:29 GMT
Still confused. Maybe you can give the detailed flow to get the result one by one.
|
|
|
Post by Mercobots on Nov 26, 2018 15:26:24 GMT
|
|
kideas
Junior Member
Posts: 69
|
Post by kideas on Nov 26, 2018 15:39:20 GMT
the condition is that if a table has all values to be 1,(so here Table B), then it should check the 6th value of the next table(Table C) if it is also 1. If true then that 1 will be be recorded right after the 6 (1,1,1,1,1,1) values of Table B creating 7 1's i.e (1,1,1,1,1,1,1,); it will then check gain if the 6th value of the next Table(Table D) is 1; if true then that 1 is recorded after the previous 7 1's making 8 1's i.e (1,1,1,1,1,1,1,1); it will then check gain if the 6th value of the next table(Table D) is 1; if false then it jumps back to the first value of table right after the Table with 6 1's (i.e Table C) and continue the recording; the 6th value is exempted if recorded already.
so for Table C and D the values 1-5 will be recorded: so we have the final results like this:
results = {0,0,0,8,8,8,1,1,1,1,1,1,1,1,0,0,8,8,8,0,0,0,8,8,0,8,8,8,8,8}
|
|
|
Post by AnkuLua on Nov 26, 2018 23:23:07 GMT
Please don't spam.
|
|