comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Printf
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Printf [message #91791] Thu, 27 August 2015 02:08 Go to next message
Dete van Eeden is currently offline  Dete van Eeden
Messages: 32
Registered: July 2015
Member
This makes No sense to me. I have the following:


filename = 'maks'+strcompress(xx)+'.txt'

File1 = filepath(filename,subdirectory = ['Final'])

openw,lun,File1,/get_lun

then I get the error OPENW: Expression must be a scalar or 1 element array in this context: FILE1.

before even getting to the printf part.

thanks
Re: Printf [message #91792 is a reply to message #91791] Thu, 27 August 2015 02:26 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
This probably means that your variable XX is an array (possibly with one element). Try

filename = 'maks'+strcompress(xx[0])+'.txt'
File1 = filepath(filename,subdirectory = ['Final'])
openw,lun,File1,/get_lun


As a side note:

IDL> print, filepath('somefile',subdirectory = ['Final'])
/usr/local/exelis/idl82/Final/somefile

Are you sure you really want to write to the default IDL root directory? If not, you can do something like this:

IDL> root_dir = '/my/data/directory/'
IDL> print, filepath('somefile',subdirectory = ['Final'], root_dir=root_dir)
/my/data/directory/Final/somefile


On Thursday, 27 August 2015 11:08:40 UTC+2, Dete van Eeden wrote:
> This makes No sense to me. I have the following:
>
>
> filename = 'maks'+strcompress(xx)+'.txt'
>
> File1 = filepath(filename,subdirectory = ['Final'])
>
> openw,lun,File1,/get_lun
>
> then I get the error OPENW: Expression must be a scalar or 1 element array in this context: FILE1.
>
> before even getting to the printf part.
>
> thanks
Re: Printf [message #91793 is a reply to message #91791] Thu, 27 August 2015 04:26 Go to previous messageGo to next message
Dete van Eeden is currently offline  Dete van Eeden
Messages: 32
Registered: July 2015
Member
Thank you! it worked.

funny thing is i use xx through the whole program in exactly the same way without a problem, only get an error at the last one

thanks for the side note!!
Re: Printf [message #91797 is a reply to message #91793] Fri, 28 August 2015 03:40 Go to previous messageGo to next message
Nikola is currently offline  Nikola
Messages: 53
Registered: November 2009
Member
On Thursday, August 27, 2015 at 12:26:22 PM UTC+1, Dete van Eeden wrote:
> Thank you! it worked.
>
> funny thing is i use xx through the whole program in exactly the same way without a problem, only get an error at the last one
>
> thanks for the side note!!

The problem that you had is in the OPENW line. If you define file1 as you did, then file1 is an array (what is ok), but with OPENW you cannot open more than one file. You could also make it as:

filename = 'maks'+strcompress(xx)+'.txt'

File1 = filepath(filename,subdirectory = ['Final'])

openw,lun,File1[0],/get_lun

...
Re: Printf [message #91799 is a reply to message #91791] Fri, 28 August 2015 15:21 Go to previous message
joyrles1996 is currently offline  joyrles1996
Messages: 27
Registered: August 2015
Junior Member
Em quinta-feira, 27 de agosto de 2015 06:08:40 UTC-3, Dete van Eeden escreveu:
> This makes No sense to me. I have the following:
>
>
> filename = 'maks'+strcompress(xx)+'.txt'
>
> File1 = filepath(filename,subdirectory = ['Final'])
>
> openw,lun,File1,/get_lun
>
> then I get the error OPENW: Expression must be a scalar or 1 element array in this context: FILE1.
>
> before even getting to the printf part.
>
> thanks

;Create of file
get_lun, u
openw, u, 'C:\Users\Joyrles\Desktop\IDL\file.txt', get_lun

;edit the file
printf, u, datas

;close your file
close, u
;release the unit
free_lun, u
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Google Earth Curtain Plot
Next Topic: help with WHERE( ) function

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:14:40 PDT 2025

Total time taken to generate the page: 0.00505 seconds