Softcore wrote:Now the thing is, you cant have an array in an array (I believe thats called a 2 dimensional array? not sure).....So we are left with defining a subarray out of an array with a maximum of 256 entries - and the entries become less if you have strings in there.
We've done tricks to pretend we have multi-dimensional arrays by dynamically building up variable names using numbers from one array and then using something like findobject() on the resulting name. Of course for that to work you have to use Monitor objects and store the data in the value portion, so the coding gets a little ugly, but there's nothing stopping you from building up multi-dimensional arrays that way.
I used Monitor objects this way: (note - this was cut from the .jzml, so the syntax may not be exact, but you get the idea)
b1.value={7, {0.31, 0.31, 0.59, 0.59, 0.72, 0.72, 0.59}, {0.45, 0.12, 0.12, 0.97, 0.97, 0.76, 0.76}};
b2.value={7, {0.31, 0.18, 0.18, 0.31, 0.31, 0.59, 0.59}, {0.34, 0.34, 0.55, 0.55, 0.12, 0.12, 0.91}};
b3.value={7, {0.31, 0.31, 0.59, 0.59, 0.72, 0.72, 0.59}, {0.56, 0.12, 0.12, 0.76, 0.76, 0.55, 0.55}};
then the code is something like this:
cfg = findobject('b' + (algNum+1));
myData = getexpression(cfg, 'value');
numPts = myData[0];
setattribute(LineArt, 'nbr', numPts);
LineArt.x = subarray(myData, 1, numPts);
LineArt.y = subarray(myData, 1+numPts, numPts);
There's nothing stopping you from using 'arr1', 'arr2', 'arr3', etc as elements in the array and then de-referencing those as well. Although I ran into size limitations trying to pre-define the arrays with large names for each element.