Jump to content

Turn string values into numbers


Recommended Posts

I have a point cloud with a string attribute "name" and unique values, like C, C1, N, VAX, etc

how do just turn each unique name attribute into unique numerical values? so all of the "C" would be 1, C1 would be 2, etc

input point cloud will change and so will the actual names.  Could be hundred of unique names.

 

Thanks

T

 

Link to comment
Share on other sites

Hey Tim,

What I'd do is do a for each loop with the name attribute as a piece
Create a Meta Import, plug this into a wrangle, and use the iteration value as the unique value.

uniqueValueBasedOnName.png.40e5ff06513a6c5b10dbf1b9d6102bb6.png

If you just need unique values, that'll work.
But if you need the value to be consistent with the names between the point clouds, it won't be.

A side effect of this method is that it will sort the points based on the name.
If you don't want the points to be reordered, you can do this instead, might be simpler.

608e07bc457de_Screenshot2021-05-01215943.png.7d0e39918cf45770ee1899cfc1d13172.png

Note that this is slower with millions of points.
speedComparison.png.dc1eebd5f14fdb586414aa3334d92856.png

Hope that helps !

uniqueValueByName.hipnc

Link to comment
Share on other sites

  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...