You are here

removing the duplicate values in array

I am trying to make the macro to remove the duplicates values in array. But i am not able to do it.

e.g A=[1,2,3,2,4,5,6]

I want only [1,2,3,4,5,6]

Any help will be appericate

thankyou

Forums: 
Taxonomy upgrade extras: 

This cannot be done with a macro because the length of the resulting array would depend on how many duplicates there were in the original, and macros cannot make variable-sized arrays. Instead you should use a conditional submodel and find some way of having the condition go false for those instances where the value is a duplicate of a previous one.

Of course that means that you have to have this on the diagram each place where you want to use the function. We are thinking about a new way of defining macros using model diagrams that would allow you to have such a function as a macro.

Thank you jaspert for the quick reply