Extract a string from a text file in function
Erik_Kran
Hello,
I am trying to extract a string from a wave text in a function:
Function Test()
WAVE Liste_Noms
string toto toto=Liste_Noms(1)
End
The following error is returned through compilation: got "Liste_Noms" instead of s string variable or string function name
Adding a $ generates another error. Replacing ( by [ does not change anything.
Thanks for your help!
Eric
First, please learn how to enclose code using the Insert Code Snippet icon.
Your code has a few mistakes. The wave is a string wave, the one line needs a semi-colon or better should be two, and the index for a wave normally belongs in square brackets. The revised code is below.
wave/T liste_noms
string toto
toto = list_noms[1]
print toto // for test purposes
end
This assumes that liste_noms is a wave in the current folder. Otherwise, this will fail with other errors.
The mistakes are typical of beginners, so I must ask: Have you gone through the basic tutorials on coding? Have you tried to reproduce some of the examples?
July 17, 2018 at 04:51 am - Permalink
In reply to First, please learn how to… by jjweimer
Thanks a lot for your reply. No a beginner however, but never got this issue before.
In fact I expected the software would implicitly recognize the nature of the liste-noms wave.
Once again thank you for your help.
Eric
July 17, 2018 at 06:04 am - Permalink
In reply to Thanks a lot for your reply… by Erik_Kran
My apologies for the mistaken presumption.
July 17, 2018 at 07:48 am - Permalink