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

Home » Public Forums » archive » help with saving jpeg forms in loops
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
help with saving jpeg forms in loops [message #90902] Mon, 11 May 2015 10:38 Go to next message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Hi

I have an Array=[120]. I wanted to store my images in a jpeg form so I typed the following code.

Array = ArrayNew(ArrayOLD, S, time)
for i=0L,Nt-1 do begin
images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
endfor

Now I added one more loop which is looping over the trials. When I typed the following it's overwritten in each trial (I expected that).

for trial=1L, 3 do begin
Array = ArrayNew(ArrayOLD, S, time)
for i=0L,Nt-1 do begin
images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
endfor
endfor

I tried few things but I couldn't manage to store my images in each trial (3 trials) for each time point (120).

Can anyone please help with that?
Re: help with saving jpeg forms in loops [message #90906 is a reply to message #90902] Tue, 12 May 2015 01:33 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, May 11, 2015 at 7:38:23 PM UTC+2, g.na...@gmail.com wrote:
> Hi
>
> I have an Array=[120]. I wanted to store my images in a jpeg form so I typed the following code.
>
> Array = ArrayNew(ArrayOLD, S, time)
> for i=0L,Nt-1 do begin
> images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
> endfor
>
> Now I added one more loop which is looping over the trials. When I typed the following it's overwritten in each trial (I expected that).
>
> for trial=1L, 3 do begin
> Array = ArrayNew(ArrayOLD, S, time)
> for i=0L,Nt-1 do begin
> images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
> endfor
> endfor
>
> I tried few things but I couldn't manage to store my images in each trial (3 trials) for each time point (120).
>
> Can anyone please help with that?

Hi,
I don't know what images_JPEG is doing with the input file name. In your case, what appears to be a file name starts with a parenthesis "(". So I cannot say much, other than that if you want to have filename number and trial number in one string you could use this:

outputFileName = 'myOutputFile_trial_'+strtrim(trial,2)+'_number_'+strtrim(i, 2)+'.jpg'

You can improve the look of this using format in the string function...

But first you have to figure out what images_JPEG does with your input.

cheers,
Helder
Re: help with saving jpeg forms in loops [message #90921 is a reply to message #90906] Tue, 12 May 2015 09:17 Go to previous message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
That was very helpful thank you very much.

I typed the following and I got the format I was looking for :)

images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+','+st rtrim(iteration,2)+').jpeg')
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: FL website moved
Next Topic: Plot southern coordinates in northen map

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

Current Time: Wed Oct 08 13:51:24 PDT 2025

Total time taken to generate the page: 0.00622 seconds