A c++ program of mine dumps some data in a loop somewhat similar to this:
f << "R Z diagnostic" << std::endl;
for (double R = 0.0; R <= 1.0; R += .1) {
for (double Z = 0.0; Z <= 1.0; Z += .1) {
f << R << " " << Z << " " << some_diagnostic(R, Z) << std::endl;
}
}
resulting in a file that can look like this at the top:
R Z diagnostic
0.0 0.0 0.0
0.0 0.1 5.2
0.0 0.2 5.8
...
0.0 0.9 4.7
0.0 1.0 4.3
0.1 0.0 0.2
0.1 0.1 1.5
...
etc...
Now, I'd like to reshape this somehow so that I can plot the diagnostic as
a function of both R and Z, using e.g. Winston.imagesc. However, I don't
want to make assumptions on the number of steps taken in either direction -
the script should "just work" even if I change the evaluation points inside
the c++ program. I tried using some combinations of `diff` and `find` to
figure out the number of rows and columns I would need in a matrix, but
usually ended up with errors such as "no method find(DataArray{Float64,1})".
I did find this page on the
documentation<http://juliastats.github.io/DataFrames.jl/reshaping_and_pivoting.html>
which
suggests to me that this shouldn't be so difficult, but I can't wrap my
head around how to do it. Help, please? =)
// T