Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
If I'm reading selectmany correctly, your worksheet highlights the need for a particular feature, that I'd like added regardless of getting 3+ dimensional arrays, namely having an "empty" data type (call it 'null', 'empty', 'nil', 'nothing' or similar).
Instead of having to explicitly initialize a loop array before stack (or certain other operations), it would be convenient to just set the the array to 'nil' before the loop and have stack automatically initialize the empty matrix with the first set of data that needs stacking.
For example, instead of
for loop ..
calculate B
if IsArray(A) then
A=stack(A,B)
else
A=B
end loop
Then write
A=empty
for loop ..
calculate B
A=stack(A,B)
end loop
This should be expected to work even when B is empty.
Another use is when filtering a list that and no elements meet the filtering criteria. At the moment, I tend to write such programs to return zero, but there are instances where I have to be careful as zero could be a legitimate value in the context of the program that called it. In such cases, returning 'empty' would be a clear indicator that there were no elements.
Stuart