"Array of common values of the non-empty arrays"-question
Hello. I have a question:
I have 4 ui-spinners (which are blank Indeterminate: true) and 4 empty Arrays.
changing a spinner fills up an Array.
for example 3 spinner have a value:
Marr = #(1,2,3,4,5) Rarr = #(3,4,5,6,7,8) /*just changed */ Larr = #() Tarr = #(4,5,6)
I want to create a 5th Array which contains all the common values of the non-empty arrays
ComArr = #(4,5)
with 2 Array i can do:
ComArr = #() If Marr.count >= 1 do ( Locarr = #() for j=1 to Marr.count do ( N = findItem Rarr Marr[j] if (N != 0) do (append Locarr Marr[j]) ) ComArr = Locarr )else( ComArr = Rarr )
But with multiple Array, you get a long list of findItem-expresions
Is there another way?
Comments
.
You can use something like this(be sure to not include the empty bitarrays)
Tools and Scripts for Autodesk 3dsMax
Sorry, it is not so long as i
Sorry, it is not so long as i thought:
still, if someone knows a better way (appendIfNOTUnique) i would like to learn :)
Studio3DR.nl
if the data are positive
if the data are positive integer , miauu had told you the best method
if not , you must travel all elements , no way else
for more elegant code , you could use two-dimensional array and function to travel
Automatic Efficient Intelligent
We change the work state
if the data are positive
if the data are positive integer , miauu had told you the best method
if not , you must travel all elements , no way else
for more elegant code , you could use two-dimensional array and function to travel
Automatic Efficient Intelligent
We change the work state