Re: Record Variable

From: Gus Correa <gus_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 30 2013 - 14:05:50 MDT

I am not sure I understand what output you expect.
Is it the list of all partial sums? (There are five of them.)
If it is, you could make y an array/vector,
store the results in the loop,
and write to the file after the loop ends.
Maybe something like this:

*************
begin

x = (/0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21/)
y = new((/5/),integer)

do t=1,20,4
y((t-1)/4) = x(t) + x(t+1) + x(t+2) + x(t+3)
end do

print(y)

asciiwrite("teste.txt",y)

end
*****************

I hope this helps,
Gus Correa

On 10/30/2013 03:45 PM, Adriane Lima Brito wrote:
>
> Hi,
>
> My name is Adriane Lima Brito and I'm starting to use the NCL, excuse my
> English but I am not yet familiar with the language. I'm doing a simple
> example to test ... I wrote a vector x and the vector sum of the values
> that were assigned to the variable y, the variable y is inside a loop =
> 1,20,4. The problem is that I can not save all values of y, I can only
> save the last value of y. I wonder how do to keep all the y values in a
> file.
>
> My script:
>
> begin
>
> x = (/0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21/)
>
> do t=1,20,4
>
> y = x(t) + x(t+1) + x(t+2) + x(t+3)
>
> print(y)
>
> asciiwrite("teste.txt",y)
>
> end do
>
> end
>
>
>
> Graciously,
>
>
>
>
>
> Escola Superior de Tecnologia - EST
>
> Manaus - AM
>
>
> CV: http://lattes.cnpq.br/8651779320884815
> *******************************************************
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 30 14:06:00 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 01 2013 - 08:58:14 MDT