
duplicate waves in other folder

valhal
Hello,
I had some problem with my following function, seems to not work however running, making the while loop, have anyone an idea?
thanks for help
Function duplicate_list(wave_name) String wave_name String list = wavelist(wave_name,";","") Variable index = 0 String wName do setdatafolder root wName = StringFromList(index, list) if (strlen(wName) == 0) break endif Wave in_wave = $wName String newName newName = wName setdatafolder refit duplicate $wName, $newName index++; while(1) End Function
Welcome to the forum!
It is not clear (to me at least) what you are trying to achieve and what is not working exactly. The code you posted does not seem to be that useful. For example, you use WaveList() but in a way which only ever creates a list with one member. It seems to me you are trying to duplicate a list of waves into another folder, but it is difficult to propose something without knowing what you are trying to do. Can you tell us a bit more?
May 13, 2024 at 04:59 am - Permalink
In reply to Welcome to the forum! It is… by chozo
hello,
thanks for your fast answer! Yes, my purpose is to copy in folder named refit a list of waves called " wavename* " where * varies with index.
Initially the waves to copy are in root.
The function runs , enters in the loop 5 times till break ( 5 is the number of waves to copy for the test) but at the end no waves in the refit folder and a message "While executing SetDataFolder, the following error occurred: No child data folder of that name exists."
I precise that refit folder does exist in root, created before the function runs.
thanks for your help
May 13, 2024 at 06:17 am - Permalink
In reply to hello, thanks for your fast… by valhal
I have edited your function, commenting out some lines that aren't needed and adding a couple of lines to create a new data folder.
May 13, 2024 at 06:43 am - Permalink
In reply to Function duplicate_list(wave… by tony
if you are using Igor Pro 9, you can do it like this:
May 13, 2024 at 06:53 am - Permalink
In reply to if you are using Igor Pro 9,… by tony
you can also duplicate by drag-and-drop in the data browser while holding the option/alt key.
May 13, 2024 at 06:56 am - Permalink
thanks Tony
May 13, 2024 at 07:12 am - Permalink
This will do a more generic duplication and has error checking. It could be improved also with Tony's Igor Pro 9 version code.
May 13, 2024 at 09:03 am - Permalink