Igor 7 problem with string waves
joerg.kunze
the following function has worked well for over 10 years. Since I upgraded to Igor 7, it does not compile any longer. Under Igor 7
strlen(w[i])
generates the error message:got "w" instead of a string variable or string function name.
Well, I have w declared as a string wave, so w[i] should be a string. What is wrong here?
function RemoveEmptyLines(w)
wave/S w
variable i = 0
do
if (strlen(w[i]) ==0)
Deletepoints i,1,w
else
i += 1
endif
while (i<numpnts(w))
end
wave/S w
variable i = 0
do
if (strlen(w[i]) ==0)
Deletepoints i,1,w
else
i += 1
endif
while (i<numpnts(w))
end
Best regards,
Joerg.
PS: For problems like this, a downgrade button to Igor 6 would be very useful.
wave/T
February 28, 2017 at 08:39 am - Permalink
I think you need to /T in your wave declaration.
Wave /T w
instead
Wave /S w
Andy
February 28, 2017 at 08:40 am - Permalink
February 28, 2017 at 08:49 am - Permalink
As for a "Downgrade Button", you can install IP6 and IP7 on the same machine and use them both if you need to. If you are getting compile errors in IP7 that you did not get with the same code in IP6, it's likely that your code is either very old or has a mistake in it. If it's a mistake, it's possible that you got the results you expected in IP6 even with that mistake (that appears to be the case here) but that's not always the case.
February 28, 2017 at 09:31 am - Permalink
Wave/T wv
Extract/O w, w, strlen(w) > 0
End
should be much faster.
February 28, 2017 at 11:21 am - Permalink
March 1, 2017 at 03:15 am - Permalink