I am really new to programming in Objective-C, my background in labview, which is a graphical programming language, I worked with Visual Basic, as well as HTML / CSS. I am trying to figure out the logic for creating a data array for the template below. I will need a template later to extract data from the other 2 arrays in a specific order.
I can do this by specifying a = 1, b = 2, c = 3, etc., and then create an array using a, b, c, but I want to use a loop so that I don't have 8 links above the array . These links will be used to generate a different generation of data, so if I canโt get help figuring out the logic, I actually get 72 links over the array.
// This is the first one that gives the pattern
0 0 0 0 (etc.) // 1 1 1 1 // 2 2 2 2 2
NSMutableArray * expSecondRef_one = [NSMutableArray array]; int a1 = 0; while (a1 < 9) { int a2 = 0; while (a2 < 8) { NSNumber * a3 = [NSNumber numberWithInt:a1]; [expSecondRef_one addObject:a3]; a2++; } a1++; }
// This is the second one I stumble on, I'm looking for a template
1 2 3 4 5 6 7 8 // 0 2 3 4 5 6 7 8 // 0 1 3 4 5 6 7 8 // 0 1 2 4 5 6 7 8 // etc to -> // 0 1 2 3 4 5 6 7
If you run it on a line, every ninth number is -1, but I donโt know how to do this from the pattern of 8.
Thanks in advance!
Graham
source share