|
Re: Openw and printf [message #56601 is a reply to message #56596] |
Sun, 04 November 2007 05:54  |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Fri, 2 Nov 2007, StevenM wrote:
> Hello Everybody,
>
> I have a 3D array [x,y,z] and I am trying to write one column to a
> file. My problem arises when I try to export the z dimension, the
> output file has gaps between each data point, in the other dimensions
> there are no gaps. Can anyone help me with how to get rid of the
> gaps.
>
> thanks
>
> Steven
>
> ps the output data looks like this
>
> 4
>
> 6
>
> 7
>
> 8
>
> when I would like
>
> 4
> 6
> 7
> 8
>
>
REFORM() will solve this:
IDL> a=indgen(2,3,4)
IDL> print, a[*,0,0]
0 1
IDL> print, a[0,*,0]
0
2
4
IDL> print, a[0,0,*]
0
6
12
18
IDL> print, reform(a[0,0,*], 1,4)
0
6
12
18
regards,
lajos
|
|
|
Re: Openw and printf [message #56602 is a reply to message #56601] |
Sun, 04 November 2007 04:27  |
StevenM
Messages: 9 Registered: June 2006
|
Junior Member |
|
|
Hi David
Thanks for the reply, no it was all done on a PC. I get the same
problem using the print command: the data in the z dimension has
spaces. And no I haven't used a format statement.
all the best
Steven
|
|
|
Re: Openw and printf [message #56612 is a reply to message #56602] |
Fri, 02 November 2007 12:20  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
StevenM writes:
> I have a 3D array [x,y,z] and I am trying to write one column to a
> file. My problem arises when I try to export the z dimension, the
> output file has gaps between each data point, in the other dimensions
> there are no gaps. Can anyone help me with how to get rid of the
> gaps.
Did you create this file on a PC and open it on a UNIX
machine? If so, I would try running dos2unix on it. This
looks more like a file transfer problem to me, than a file
writting problem. Did you use some kind of format statement?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|