<p>The solution as pointed out by samcarter in the above comment was to remove the tab in conto.con so that it had linebreak + linebreak instead of linebreak + tab + linebreak</p>

CC BY-SA 4.0
2019-10-07T17:08:48.600Z
2019-10-07T17:08:48.600Z
Shakti
<p>I have an ASCII file (.con) with the coordinates of vertices of different contours. This file is obtained from Matlab. Now after every set of contour ends there needs to be a blank row in the contour file. In place of this, I have a row with Nan Nan in it when Matlab writes the file. What I do is simply find and Replace the Nan with nothing. But when I load the contour file in ds9 it gives me weird contours. I'm also posting the result I expect (fig 1) and the result I'm getting (fig 2). The problem here that I've understood till now is that if I copy and paste every contour block of coordinates separately into the .con file the result is as expected but I want the whole process of writing the contours from Matlab into the file such that it gives me the expected result in ds9 to be automated (basically I don't want to copy and paste every block). Can somebody help with this?</p>

<p>This is what I expect:</p>

<p><a href="https://i.sstatic.net/beabl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/beabl.png" alt="This is what I expect"></a></p>

<p><a href="https://i.sstatic.net/RVJE4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RVJE4.png" alt="This is what I get"></a></p>

<p>Link for the .con file that gives the right result: <a href="https://drive.google.com/open?id=1tDMXtmywJnSjpi_CzCI5-F85oFpebnl4" rel="nofollow noreferrer">https://drive.google.com/open?id=1tDMXtmywJnSjpi_CzCI5-F85oFpebnl4</a></p>

<p>Link for the .con file that gives the wrong result: <a href="https://drive.google.com/file/d/18rgN1UVtvcyfJSuh1mmbqOVQCna_aAUM/view" rel="nofollow noreferrer">https://drive.google.com/file/d/18rgN1UVtvcyfJSuh1mmbqOVQCna_aAUM/view</a></p>

CC BY-SA 4.0
2019-10-04T14:06:03.217Z
Can you share a small sample .con file before and after you edit it?
samcarter_is_at_topanswers.xyz
CC BY-SA 4.0
2019-10-04T18:32:37.757Z
You mean the one which gives the right result and the one which does not? or before and after I delete the NaNs?
Shakti
CC BY-SA 4.0
2019-10-04T19:59:10.393Z
yes, it does not need to be the whole file, two blocks would be enough. (my suspicion is that it might be related to spaces, tabs or something like that)
samcarter_is_at_topanswers.xyz
CC BY-SA 4.0
2019-10-06T06:01:23.420Z
I've added the files. To me, there does not seem to be any space tab difference between the two
Shakti
CC BY-SA 4.0
2019-10-07T12:55:42.547Z
There is indeed a difference with tabs: in conto.con the empty line consist of `linebreak`+`tab`+`linebreak`, in contop.con it is `linebreak`+`linebreak`.
samcarter_is_at_topanswers.xyz
CC BY-SA 4.0
2019-10-07T17:05:58.830Z
Oh yeah, sorry didn't notice that. All that just because of a tab. Thank you, problem solved
Shakti
CC BY-SA 4.0
2019-10-07T17:23:36.677Z
Good to hear that your problem is solved!
samcarter_is_at_topanswers.xyz
<data-analysis><ds9>
Loading contour file in ds9
Shakti
# Loading contour file in ds9

(Asked by: username_0 on 2019-10-04)

I have an ASCII file (.con) with the coordinates of vertices of different contours. This file is obtained from Matlab. Now after every set of contour ends there needs to be a blank row in the contour file. In place of this, I have a row with Nan Nan in it when Matlab writes the file. What I do is simply find and Replace the Nan with nothing. But when I load the contour file in ds9 it gives me weird contours. I'm also posting the result I expect (fig 1) and the result I'm getting (fig 2). The problem here that I've understood till now is that if I copy and paste every contour block of coordinates separately into the .con file the result is as expected but I want the whole process of writing the contours from Matlab into the file such that it gives me the expected result in ds9 to be automated (basically I don't want to copy and paste every block). Can somebody help with this?

This is what I expect:

[![This is what I expect](https://i.sstatic.net/beabl.png)](https://i.sstatic.net/beabl.png)

[![This is what I get](https://i.sstatic.net/RVJE4.png)](https://i.sstatic.net/RVJE4.png)

Link for the .con file that gives the right result: <https://drive.google.com/open?id=1tDMXtmywJnSjpi_CzCI5-F85oFpebnl4>

Link for the .con file that gives the wrong result: <https://drive.google.com/file/d/18rgN1UVtvcyfJSuh1mmbqOVQCna_aAUM/view>

**Tags:** data-analysis, ds9

> **Comments:**
> **username_1**: Can you share a small sample .con file before and after you edit it?  
> **username_0**: You mean the one which gives the right result and the one which does not? or before and after I delete the NaNs?  
> **username_1**: yes, it does not need to be the whole file, two blocks would be enough. (my suspicion is that it might be related to spaces, tabs or something like that)  
> **username_0**: I've added the files. To me, there does not seem to be any space tab difference between the two  
> **username_1**: There is indeed a difference with tabs: in conto.con the empty line consist of `linebreak`+`tab`+`linebreak`, in contop.con it is `linebreak`+`linebreak`.  
> **username_0**: Oh yeah, sorry didn't notice that. All that just because of a tab. Thank you, problem solved  
> **username_1**: Good to hear that your problem is solved!  

---

## 1 answers

### Answer by username_0 on 2019-10-07. Score: 1 | Accepted answer

The solution as pointed out by samcarter in the above comment was to remove the tab in conto.con so that it had linebreak + linebreak instead of linebreak + tab + linebreak


---

