Hello,
I am trying to assign text from one wave to another, that is, I have a text wave, w1, and I am trying to assign its elements to another wave, w2, but I receive the error "a wave assignment error: "An attempt was made to treat a text wave as if it were a numeric wave.""
I've tried a simplified version of what I am attempting to do:
Function Example()
Variable i
Make/T/O w1= {"a","b","c"}
Make/T/O w2
For (i=0; i<numPnts(w1); i+=1)
w2[i] = w1[i]
EndFor
End
And this work exactly how I would have expected it to. Any suggestions?
Hi,
I ran your example as posted and it worked without issue. Created 2 text waves W1 of length 3 points and W2 of 128 with a,b, and c in the right spot.
Tried on IP8.
Can you supply the non-simplified code?
Andy
Yes, that example does work exactly how you would expect it to. I have a chunk of my code pasted below. It is just a snippet of the larger procedure I am working on but this section is essentially merging data, under three different conditions, inserting the data into different parts of an already existing waves. I am receiving the error for the line:
If you create a wave reference pointing to a text wave, you need to use the /T flag so that the Igor compiler knows it is a text wave. For example:
Function Test()// Make with a simple name - Creates an automatic wave reference named textwave0Make/O/T textwave0
Wave/T textwave0 // This is redundant - Make already creates the wave reference// Make without a simple name - no automatic wave reference is createdString name = "textwave1"Make/O/T/N=3$name = "Hello"Wave/T tw1 = $name// This is required because no automatic wave reference is created// Reference to a text wave named textwave2 that is assumed to already exist in the current data folderWave/T tw2 = textwave2
End
I recommend rereading this section of the help. It takes both experimentation and rereading before if all sinks in.
June 27, 2018 at 06:47 am - Permalink
Stats_StatusFlag[FirstPoint + i] = Load_Stats_StatusFlag0[i]
These two waves are both text waves. Also, I am using Igor Pro 6.3.7.2.
June 27, 2018 at 07:01 am - Permalink
June 27, 2018 at 07:14 am - Permalink
June 27, 2018 at 07:29 am - Permalink