Extract a string from a text file in function

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.

Function Test()

    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?

In reply 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