小编wha*_*ace的帖子

gnuplot将一个数字从数据文件存储到变量中

OSX v10.6.8和Gnuplot v4.4

我有一个包含8列的数据文件.我想从第6列获取第一个值并将其作为标题.这是我到目前为止所拥有的:

#m1 m2 q taua taue K avgPeriodRatio time
#1  2  3   4   5   6        7        8

K = #read in data here
graph(n) = sprintf("K=%.2e",n) 
set term aqua enhanced font "Times-Roman,18"

plot file using 1:3 title graph(K)
Run Code Online (Sandbox Code Playgroud)

以下是我的数据文件的前几行:

1.00e-07 1.00e-07 1.00e+00 1.00e+05 1.00e+04 1.00e+01 1.310 12070.00
1.11e-06 1.00e-07 9.02e-02 1.00e+05 1.00e+04 1.00e+01 1.310 12070.00
2.12e-06 1.00e-07 4.72e-02 1.00e+05 1.00e+04 1.00e+01 1.310 12070.00
3.13e-06 1.00e-07 3.20e-02 1.00e+05 1.00e+04 1.00e+01 1.310 12090.00
Run Code Online (Sandbox Code Playgroud)

我不知道如何正确读取数据,或者这是否是正确的解决方法.

编辑#1

好的,多亏了我现在的mgilson

#m1 m2 q …
Run Code Online (Sandbox Code Playgroud)

variables gnuplot

11
推荐指数
2
解决办法
2万
查看次数

可能由if语句引起的C++布尔逻辑错误

这是我遇到问题的一段代码的极简化版本.

int i = 0;
int count = 0;
int time = 50;
int steps = 1000;
double Tol = 0.1;
bool crossRes = false;
bool doNext = true;

for (int i=0; i<steps; i++) {

//a lot of operations are done here, I will leave out the details, the only
//important things are that "dif" is calculated each time and doNext either
//stays true or is switched to false

    if (doNext = true) {
        if (dif <= Tol) count++;
        if …
Run Code Online (Sandbox Code Playgroud)

c++ boolean-logic if-statement

0
推荐指数
1
解决办法
653
查看次数

标签 统计

boolean-logic ×1

c++ ×1

gnuplot ×1

if-statement ×1

variables ×1