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

Home » Public Forums » archive » Writing float array to file
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
Writing float array to file [message #91426] Tue, 14 July 2015 01:56 Go to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Hey there!

I have a quite simple problem but I didn't find a solution yet.

Given a float array with the dimensions 2048*5492 ("variables[0]"), I want to put these files in a .csv-file...

This is what I have:

b1=foldername[f]+'\b1.csv'
OPENW,1,b1
PRINTF,variables[0]
CLOSE,1

The error I get is:

PRINTF: Expression must be a scalar or 1 element array in this context: <FLOAT Array[2048, 5492]>.

What does it mean?

Thanks
Re: Writing float array to file [message #91427 is a reply to message #91426] Tue, 14 July 2015 02:25 Go to previous messageGo to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Am Dienstag, 14. Juli 2015 10:56:16 UTC+2 schrieb Kai Heckel:
> Hey there!
>
> I have a quite simple problem but I didn't find a solution yet.
>
> Given a float array with the dimensions 2048*5492 ("variables[0]"), I want to put these files in a .csv-file...
>
> This is what I have:
>
> b1=foldername[f]+'\b1.csv'
> OPENW,1,b1
> PRINTF,variables[0]
> CLOSE,1
>
> The error I get is:
>
> PRINTF: Expression must be a scalar or 1 element array in this context: <FLOAT Array[2048, 5492]>.
>
> What does it mean?
>
> Thanks

Just found the mistake...

The line: "PRINTF,variables[0]"
Should be: "PRINTF,1,variables[0] "
Re: Writing float array to file [message #91428 is a reply to message #91426] Tue, 14 July 2015 03:22 Go to previous message
Nikola is currently offline  Nikola
Messages: 53
Registered: November 2009
Member
It means that you're missing the unit in the call of PRINTF

b1=foldername[f]+'\b1.csv'
OPENW, 1, b1
PRINTF, 1, variables[0]
CLOSE, 1

Anyway, it likely won't do what you want as variables[0] is just the first element of your matrix.

b1 = foldername[f]+'\b1.csv'
OPENW, un, b1, /get_lun
PRINTF, un, variables
FREE_LUN, un

In any case what you'll get is not really a csv (comma separated values) file. If that's what you want, then try to google how to write csv from IDL. If you plan to use the data for further analysis in IDL, csv is not very smart choice - one would rather go for plain ascii table, binary or the native IDL .sav format.




On Tuesday, July 14, 2015 at 9:56:16 AM UTC+1, Kai Heckel wrote:
> Hey there!
>
> I have a quite simple problem but I didn't find a solution yet.
>
> Given a float array with the dimensions 2048*5492 ("variables[0]"), I want to put these files in a .csv-file...
>
> This is what I have:
>
> b1=foldername[f]+'\b1.csv'
> OPENW,1,b1
> PRINTF,variables[0]
> CLOSE,1
>
> The error I get is:
>
> PRINTF: Expression must be a scalar or 1 element array in this context: <FLOAT Array[2048, 5492]>.
>
> What does it mean?
>
> Thanks
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Advice on using julian day with the image function?
Next Topic: Compare satellite images

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

Current Time: Wed Oct 08 07:17:32 PDT 2025

Total time taken to generate the page: 0.00439 seconds