Transfer of text items between text waves
HansF
I have data from several analytical measurements combined with a corresponding sample code in a text wave. After performing calculations to track analytical errors I wish to create a new text wave containing only the sample codes of the wrong samples.
In a first attempt I simply wrote, as is usual for numbers:
samplecode1[k]=samplecode2[m]
This does not work. Then I tried to write a sample code to a string and to read it into a new text wave:
string_test=samplecode1[1]
samplecode2[0]=string_test
This works perfectly in the Command window but not in a program. Sofar, I did not find any hint how to achieve this simple operation.
Thanks for your input!
Hans
The following test code works for me in both v6.38 and v7.05 on Win7.
make/t/o wtext = "test"
make/t/o wtext2 = "test2"
variable k = 0
variable m = 1
wtext2[k] = wtext[m]
print wtext2[k]
end
The printed output is "test."
Can you post a similar, simple function that shows the problem?
January 23, 2018 at 08:58 am - Permalink
The failure appreared simply to be due to the fact that in the wave declaration at the start of the function I declared the sample code wave as "Wave" and not as "Wave/T". The other text wave is made in the program and correctly defined
Changing the initial declaration solved the problem! Thanks again for your kind help! (As I am not really new to IGOR I feel a bit ashamed...)
Hans
January 23, 2018 at 11:04 am - Permalink