|
From: AstroPhysik <bwv...@gm...> - 2011-10-29 19:27:02
|
Hi Thomas,
Thank you very much!
plot "star.dat" using 7, f(x) t "mean <x>" , 1.*GewMW t "w.mean" w l
did the trick =)
regards AP.
Thomas Sefzick wrote:
>
> just tell gnuplot that 'GewMW' doesn't contain a filename but a numerical
> value:
> plot 1.*GewMW
>
>
> AstroPhysik wrote:
>>
>> Hi Folks!
>> How can i convert in gnuplot strings to double?
>>
>> I use AWK for calculating in a data file some weighted means. The result
>> should be displayed in gnuplot.
>>
>> GewMW = system("gawk '{total+=$7; Nges+=1; Mean =
>> total/Nges;PhysikalischeWerte[$7] = $7;for(i=1; i<=Nges;i++)
>> Gewichtung[i] = 100.00 -((100.00/Nges) * (i-1));for(i=1; i<=Nges;i++)
>> SummeGewichtung += Gewichtung[i];for(i=1; i<=Nges;i++) SummeMW += (Mean *
>> Gewichtung[i]);GewichteterMittelwert =SummeMW /SummeGewichtung; } END
>> {print GewichteterMittelwert }' Stern.dat");
>>
>>
>> print GewMW
>>
>> print GewMW shows the correct result but AWK or Gnuplot convert here the
>> result to a string: "GewMW = system(..)" which is saved in GewMW.
>> This string i cannot process with plot..
>>
>> plot "Stern.dat" using 7, f(x) t "mean <x>" , GewMW t "w.mean" w l
>>
>> .. shows only the first mean but not the weighted mean from the value
>> GewMW (because it is a string here..)
>>
>> i've also written a small C++ Programm "stringToDouble(.. string )"
>> which returns a double, but i cannot call it in the correct way from
>> gnuplot?
>>
>> GewMW = system( stringtodouble(GewMW) );
>> GewMW = system("./stringtodouble(GewMW)");
>>
>> The Listnings above bring the errormessages:
>> "Star.dat", line 93: undefined function: stringtodouble
>> and:
>> sh: Syntax error: word unexpected (expecting ")")
>>
>> I also tried to save the output to a file..
>>
>> save '|grep GewMW >temp.dat';
>>
>> and try to re-read it in gnuplot, hoping it will be interpreted as a
>> numeric value (double)..
>>
>> Ähhhmmm, yes.. so faar.. nothing is working..
>>
>> Does anyone have a tip which is more elegant/beautiful as mine are?
>>
>> Thank you, :-)
>> AstroPhysik
>>
>
>
--
View this message in context: http://old.nabble.com/Gnuplot%3A-How-to-convert-STRINGS-in-DOUBLE--%28with-AWK%29-tp32742966p32744958.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|