Concatenate in Function

Hello,

I wish to read wave names from a CONCATENATED text wave and then read data from the specific wave. However, I always got the error message:
"Got "wavenames_all" instead of a string variable or string function name."
The un-concatenated waves won't generate such an error though. What I'm missing here?
Thanks.
zh

function test1()
make/O/N=10 wave0=p/10, wave1=wave0^2, wave2=wave0^3, wave3=wave0^4
end

function test2()
make/O/T/N=2 wavenames1={"wave0", "wave1"}
make/O/T/N=2 wavenames2={"wave2", "wave3"}
concatenate/NP/O {wavenames1, wavenames2}, wavenames_all
wave w=$wavenames1[1]; print w   // this works fine
wave w1=$wavenames_all[3]   //this doesn't work
duplicate/O wavenames_all abc
wave w1=$abc[3]    // doesn't work either
end
Consider the changes in this ...

function NameTest()
    make/O/T/N=2 wavenames1={"wave0", "wave1"}
    make/O/T/N=2 wavenames2={"wave2", "wave3"}
    concatenate/NP/O/T {wavenames1, wavenames2}, wavenames_all
    print wavenames_all[1]
    duplicate/O/T wavenames_all abc
    print abc[3]
end


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
In the case of both Concatenate and Duplicate, you need to add a /T flag to tell the Igor compiler that the output wave is a text wave.