0

I am trying to plot a set of graphs to compare the simulation results with the experimental data. The simulation files are in ordered arrangement on 7X7X7 for various parameters. I need to plot all of those files using a nested for loop for each iXjXk file. The files are named thus : fibrilAll_i_j_k.dat

I have already tried some alternatives like using multiple for loop in the same line. But it doesn't seem to work.

set terminal eps size 1200,800
set output "all.eps"
set title "{/*2 Alternative rates}"
set ylabel "{/*2 fibril mass fraction}" offset 1.5,0,0
set xlabel "{/*2 Time(h)}"
set key left top
plot 'experiment.txt' using 1:6 ps 2 pt 5 title "EXP",\
for [i=1:7] for [j=1:7] for [k=1:7] 'fibrilAll'._i_j_k.'.dat' using 1:2 with lines title 'i,j,k'
replot

I get the following error message:

internal error : STRING operator applied to undefined or non-STRING variable

1 Answer 1

0

I see a few possible problems.

1) I take it you do not want to plot the same file fibrilAll_i_j_k.dat 343 times. If the data files are named e.g. fibrilAll_1_5_3.dat then you can construct that name by saying plot ... sprintf("fibrilAll_%d_%d_%d.dat",i,j,k)

2) Probably you want something similar for the titles

3) The replot does not accomplish anything. Did you leave out something?

Sign up to request clarification or add additional context in comments.

2 Comments

I tried the following and it worked set terminal png size 1200,800 set output "all.png" set title "{/*2 Alternative rates}" set ylabel "{/*2 fibril mass fraction}" offset 1.5,0,0 set xlabel "{/*2 Time(h)}" set key left top plot 'experiment.txt' using 1:6 ps 2 pt 5 title "EXP" do for [i=1:7]{ do for [j=1:7]{ do for[k=1:7]{ filename = sprintf("%s_%d_%d_%d.%s",'fibrilAll',i,j,k,'dat') plot filename using 1:2 with lines title "1",\ } } }
Ah. It was not clear in the original question that you wanted to plot each file separately rather than plotting all of the files in a single figure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.