# Export solution

**URL:** <https://community.freefem.org/t/export-solution/822>\
**Category:** General Discussion\
**Created:** [February 21, 2021, 3:32pm UTC](https://community.freefem.org/t/export-solution/822 "2021-02-21T15:32:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emma87](https://avatars.discourse-cdn.com/v4/letter/e/e47774/32.png) [@Emma87](https://community.freefem.org/u/Emma87)\
**Post date:** [February 21, 2021, 3:32pm UTC](https://community.freefem.org/t/export-solution/822/1 "2021-02-21T15:32:18Z")

</div>

Dear FreeFem community!

I would like to know if there is an example to save a 2D solution for 1D, considering a unit square domain, and wanting to save for example the solution on the axis Y = 0.5

---

<div class="post-metadata">

**Author:** ![henkel](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@henkel](https://community.freefem.org/u/henkel)\
**Post date:** [February 22, 2021, 12:03pm UTC](https://community.freefem.org/t/export-solution/822/2 "2021-02-22T12:03:52Z")

</div>

Given a FE-function `u`, you can get the value at some point (for example (1, 0.5)), like this: `u(1, 0.5)`.If you iterate over the x-coordinate, you can sample a line.

---

<div class="post-metadata">

**Author:** ![arousta](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@arousta](https://community.freefem.org/u/arousta)\
**Post date:** [February 22, 2021, 7:46pm UTC](https://community.freefem.org/t/export-solution/822/3 "2021-02-22T19:46:13Z")

</div>

Just to giving a sample code to complement the previous answer:  
(f is a FE field)  
ofstream o(“line\_output”);  
int Np = 50;  
real delx = (x1-x0)/(Np-1.);  
real dely = (y1-y0)/(Np-1.);  
real xp = x0;  
real yp = y0;  
for(int i=0; i\<Np; ++i){  
o \<\< xp \<\<" “;  
o \<\< yp \<\<” “;  
o \<\<f(xp,yp)\<\<”\n";  
xp += delx;  
yp += dely;  
}

---

<div class="post-metadata">

**Author:** ![Emma87](https://avatars.discourse-cdn.com/v4/letter/e/e47774/32.png) [@Emma87](https://community.freefem.org/u/Emma87)\
**Post date:** [February 23, 2021, 6:12pm UTC](https://community.freefem.org/t/export-solution/822/4 "2021-02-23T18:12:26Z")

</div>

Thank you, your tips were very useful!
