cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed: MAPS

Newbie

Help needed: MAPS

How do SmartAssembly maps work? I've never used one before in SA, but I think I should....Do they function as a set against which something can be compared?


Thanks in advance for your help 🙂

2 REPLIES 2

RE: Help needed: MAPS

Hi Geoff,



Maps are a temporary storage space for information, simliar to arrays, but with a twist.


With maps, you have to specify a data type, DOUBLE, STRING OR INTEGER (no references). Once you've specified a type, each element within a Map has two bits of information in it, the element "Key" and the element "Value".


The idea behind this structure is that you can add elements to an array (the Value) and assign a direct name for that value (the Key). With this structure, you can extract any value simply by searching the map (using the GET_MAP_ELEM command) by the key name.


For example, you could have a string map that contains different calculated values:


KEY 1390.99 22398.33


Calculated_3 23.22


Most maps are used to store vast amounts of data in them rather than smaller bits of information (like shown above). Some would argue that you can do the same thing with arrays; however, the nice thing with the map is that I can store my value against a specific key, whereas in the array, the system will store them in sequence, making it vital to know which element number contains my required value. With maps, I can simply recall the value I need against a specific key.


You can also process maps using a FOR loop; however, it is important to note that the map will be processed in alpha/numeric order (From A to Z, then 0 to infinity), or in reverse alpha/numeric order (infinity to 0, then Z to A).


Hope this helps.


Joel Beckley


Application Engineer


SIGMAXIM

RE: Help needed: MAPS

Thanks, Joel, that definitely helps.


Design well!

Announcements