Menu

Read string from txt to gnuplot variable?

Help
2017-03-12
2017-03-12
  • artiny sixtee

    artiny sixtee - 2017-03-12

    Hy,
    I want to read from txt file (what is contain only one word) ...and use it as variable (as a string) in gnuplot. HOw can I make it?

     
    • Ethan Merritt

      Ethan Merritt - 2017-03-12

      On Sunday, 12 March 2017 10:08:02 PM artiny sixtee wrote:

      Hy,
      I want to read from txt file (what is contain only one word) ...and use it as variable (as a string) in gnuplot. HOw can I make it?

      VAR = "cat textfile"

       
      • artiny sixtee

        artiny sixtee - 2017-03-13

        Thank you for answer.

        I dont know why but didnt work for me....
        the lastPatch.txt contain this text:
        x.png

        I tried this:
        VAR = "cat lastPatch.txt"

        but this command make new textfile with name:
        cat lastPatch.txt
        and contain some undefined symbols:
        ‰PNG
        

         
  • Bastian Märkisch

    You have to use backtics, not double quotes. See

    help backquotes
    
     
  • artiny sixtee

    artiny sixtee - 2017-03-13

    I tried this:
    VAR = ’cat lastPatch.txt’

    result:
    create new textfile "cat lastPatch.txt" with undefined symbols:
    ‰PNG
    

     

    Last edit: artiny sixtee 2017-03-13
    • Bastian Märkisch

      Backquotes, not single quotes. Like in

      var = "`cat file.txt`"
      

      Or try

      var = system("cat file.txt")
      
       
  • artiny sixtee

    artiny sixtee - 2017-03-13

    thank you :) now working
    var = system("cat file.txt")

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.