2013-07-25 3 views
1

나는 그래프 한 묶음을 그리는 간단한 gnuplot 스크립트를 가지고있다.GNUPLOT : 표현이 잘못 되었습니까?

편집 : 나는 그것을 실행하면 다음과 같은 오류를 제공합니다 내가 해결하기 위해 노력에 많은 시간을 보냈다

; 
    set xrange [pe_cnt:range_high]; 
    set xtics xticks; 
    set xtics add (pe_cnt) 
                       ^
line 26: invalid expression 

제안에 따라 상당히 코드의 길이를 줄였다 이. 아무도 나를 도울 수 있다면 정말 고마워. 이건 내 코드입니다 :

range_high="`awk '{for(i=1;i<=NF;i++) if ($i=="--stop") print $(i+1)}' temp_info`" 
xticks="`awk '{for(i=1;i<=NF;i++) if ($i=="--xticks") print $(i+1)}' temp_info`" 
pe_cnt = "`awk '{for(i=1;i<=NF;i++) if ($i=="--pe_cnt") print $(i+1)}' temp_info`" 
rd_cnt = "`awk '{for(i=1;i<=NF;i++) if ($i=="--rd_cnt") print $(i+1)}' temp_info`" 


################################################################################################## 
# Gnuplot script file for plotting Micron >= 1,16,32,64 WAFL single read last read 


set autoscale  
set grid   
set title "Usable Flash Blocks vs PE cycles" 

set xlabel "PE Cycles " 
set ylabel "% Usable Flash Blocks " 
set y2label "% WAFL Blocks" 

if (pe_cnt == range_high) { 
    set xrange [pe_cnt-1:range_high] 
    set xtics xticks 
    set xtics add (pe_cnt-1) } 
else { 
    set xrange [pe_cnt:range_high] 
    set xtics xticks 
    set xtics add (pe_cnt) } 

set yrange [-10:140] 
set y2range [-10:140] 

set ytics 10 
set y2tics 10 

set term postscript color solid 
set output 'Micron_srd.ps' 

#set datafile separator ' ' 

set key top left 
plot "Micron_all"  using (($1+1)*pe_cnt):(((256-$31)*100)/256) smooth bezier title '(>= 1 Bad WAFL)'  axis x1y1 with lines, \ 
    "Micron_all"  using (($1+1)*pe_cnt):(((256-$33)*100)/256) smooth bezier title '(>= 16 Bad WAFL)'  axis x1y1 with lines, \ 
    "Micron_all"  using (($1+1)*pe_cnt):(((256-$34)*100)/256) smooth bezier title '(>= 32 Bad WAFL)'  axis x1y1 with lines, \ 
    "Micron_all"  using (($1+1)*pe_cnt):(((256-$36)*100)/256) smooth bezier title '(>= 64 Bad WAFL)'  axis x1y1 with lines, \ 
    "Micron_all"  using (($1+1)*pe_cnt):(($14*400)/$5) smooth bezier title '(Uncorrectable WAFL)'  axis x1y2 with lines, \ 
    "Micron_all"  using (($1+1)*pe_cnt):(($70*100)/$5) smooth bezier title '(Correctable WAFL)'  axis x1y2 with lines 
+1

[작은 자체 포함 예제] (http://www.sscce.org)를 작성해주십시오. 문제가 무엇인지 알아내는 것이 훨씬 쉬워 질 것입니다. 다른 사람들과 자신을 위해서입니다. –

+0

@that_other_guy 코드를 줄 였지만 여전히 같은 오류가 발생합니다. 왜 이런 일이 벌어지고 있는지 모르겠습니다. 이 스크립트와 동일한 스크립트가 있지만 작동합니다. – Rahul

+0

OK 그래서 내가 "xtics add (pe_cnt)를 추가"라는 줄에 주석을 달았을 때 오류가 사라지지만 아무도 왜 오류를 얻고 있는지 말할 수 있습니까? 내가 확인한 구문이 올바른지. – Rahul

답변

1

사용

set xtics add (real(pe_cnt)) 

것 같아요 : 여기

는 동일한 코드와 같은 오류 메시지를 보여 짧은 자체에 포함 된 예이다 왜냐하면 문자열이 처음 발생할 때 다른 구문을 사용할 수 있기 때문입니다. 다음은 캐스트입니다.

set xtics add (pe_cnt pe_cnt) 
1

문제는 pe_cnt은 숫자가 아니라 테스트 케이스 자체에 포함 (이 일부 파일에서이 값을 읽고) 아닌 것 같다, 그래서 구체적으로 어렵다. xtics add가 자동으로 문자열을 캐스팅하지 않습니다,

pe_cnt = "kittens" 
set xtics add (pe_cnt)