rscott9399 Posted June 21, 2019 Report Share Posted June 21, 2019 I have tried repeatably to delete the last few letters from a specific array. I can not get it to work with the subset function nor the delete portion of array function. Any suggestions? Quote Link to comment
Tim_S Posted June 21, 2019 Report Share Posted June 21, 2019 Your post is a bit confusing as you're interchanging string and array terms. Cleaning that up and posting a bit of what you've tried would help people give better feedback. It sounds like you're using primitives that would do what you want, so it would be helpful to see how you are using them. Quote Link to comment
Michael Aivaliotis Posted June 21, 2019 Report Share Posted June 21, 2019 I dunno. Your question is not clear, but let me take a shot. This example deletes the last 3 elements of an array of strings. Don't forget that array indexes start at 0, not 1. Quote Link to comment
Rolf Kalbermatter Posted June 22, 2019 Report Share Posted June 22, 2019 Michael, technically what you write is only true for an input array of exactly 5 elements. If you really always want to remove the last three elements the OP needs to use an Array Length node, subtract the number of elements he wants to remove from this length and wire that to the offset. In that case you can leave the size input unwired because it will default to the rest of the array. Quote Link to comment
crossrulz Posted June 22, 2019 Report Share Posted June 22, 2019 14 hours ago, Rolf Kalbermatter said: If you really always want to remove the last three elements the OP needs to use an Array Length node, subtract the number of elements he wants to remove from this length and wire that to the offset. In that case you can leave the size input unwired because it will default to the rest of the array. That's too complicated. Just wire the 3 to the Length and leave the Index unwired. Delete From Array will default to deleting from the end. 1 Quote Link to comment
Michael Aivaliotis Posted June 23, 2019 Report Share Posted June 23, 2019 The OP didn't clarify his requirements so we could all be wrong. But ya, all you guys say is true. - Thanks. My intent was to start the conversation, not to provide the best solution. I just wanted to show how the delete from array works and to provide some visuals. Quote Link to comment
hooovahh Posted June 24, 2019 Report Share Posted June 24, 2019 Okay for the heck of it here is my interpretation. I read that as OP trying to remove the last few characters from each string in an array. (also I read "few" as 3). Also snippets might not be working so attached is a VI in 2018. Remove Strings Test.vi 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.