Your solution is the best one, since WaveList is designed to return a list of items separated by some character or string. But it turns out that WaveList doesn't insist that the separator string have anything in it. So if you pass "" as the separator you get what you want. But if you have two waves that satisfy the match string, then you get two wave names smooshed together.
This is potentially dangerous code from a performance perspective. It's fine now, but if you were to later decide that you need to call StringFromList in a loop and made the simplest obvious change to
where n is your loop iterator, now you have poorly performing code if you have a lot of waves in the current data folder and/or n gets very large.
If you only need to remove a trailing semicolon, you can use RemoveEnding instead of StringFromList.
If there's any possibility that you would have more than one wave named "RT*" in the current data folder, you might want to rethink your approach. The WaveList documentation does not specify the order in which waves are returned, so you should not rely on any particular order. In practice the order is unlikely to change, but the current implementation returns waves in the order in which they were added to the current data folder, which is probably not the order you would expect.
Thank you both for the insight. There will never be another RT* wave in any one folder. Using double quotes as the separtor string is a good tip. Remembering that the waves may not be listed in the same order is important to remember. Thanks.
Ok, I found another way to get what I want.
Genwave = stringfromlist(0,Wavelist("RT*",";",""))Genwave = Wavelist("RT*",";","")April 6, 2026 at 12:31 pm - Permalink
Your solution is the best one, since WaveList is designed to return a list of items separated by some character or string. But it turns out that WaveList doesn't insist that the separator string have anything in it. So if you pass "" as the separator you get what you want. But if you have two waves that satisfy the match string, then you get two wave names smooshed together.
April 6, 2026 at 01:46 pm - Permalink
This is potentially dangerous code from a performance perspective. It's fine now, but if you were to later decide that you need to call StringFromList in a loop and made the simplest obvious change to
where n is your loop iterator, now you have poorly performing code if you have a lot of waves in the current data folder and/or n gets very large.
If you only need to remove a trailing semicolon, you can use RemoveEnding instead of StringFromList.
If there's any possibility that you would have more than one wave named "RT*" in the current data folder, you might want to rethink your approach. The WaveList documentation does not specify the order in which waves are returned, so you should not rely on any particular order. In practice the order is unlikely to change, but the current implementation returns waves in the order in which they were added to the current data folder, which is probably not the order you would expect.
April 7, 2026 at 07:53 am - Permalink
Thank you both for the insight. There will never be another RT* wave in any one folder. Using double quotes as the separtor string is a good tip. Remembering that the waves may not be listed in the same order is important to remember. Thanks.
S
April 7, 2026 at 10:12 am - Permalink