Thanks Helio,
I actually just forgot the "." for the element-wise iteration over A.
The solution is given by summing up the resulting C which gives the
position A[i] for which B>=A[i]. If the sum(C)+1 is greater cols(A), B
is never greater than any A[i]:
<hansl>
A = seq(4,1)
matrix B = 3
C = (B.>=A)?0:1
matrix pos = 0
pos = sum(C)+1
pos
pos<\hansl>
@ Richard: This is my first idea, but I was looking for a simpler way
avoiding any use of loops here.
Artur
Am 21.11.2013 12:58, schrieb Dr RJF Hudson:
Hi there,
this is an ordinary if then or else loop in Fortran and Basic, but instead
of storing the found result in "C"
I'suggest creating a (4x1) matrix columm vector and store the "found values
in the column vector at each "i" location
and I suspect it is the same in Gretl but I confess to being a novice at
Gretl sorry to say right now
Best wishes to all,
Hope these few commnts are of small help
Good luck
Richard Hudson
Dr RJF Hudson
----- Original Message -----
From: "Artur T." <artur.tarassow(a)googlemail.com>
To: "Gretl list" <gretl-users(a)lists.wfu.edu>
Sent: Thursday, November 21, 2013 9:05 PM
Subject: [Gretl-users] small practical issue
> Hi gretl users,
>
> I am looking for a simple way to determine the column for which scalar B
> is, let's say, larger or equal to the entry A[i] and store this
> information in scalar C. If B is never greater than any entry in A[i], C
> is zero.
> Reading out each entry via a loop is possible, but I am wondering
> whether there is a short-cut to this.
>
> C = 0
> A = seq(4,1)
> B = 3
> # check at which entry A[i] the value of B >= A[i]
>
> Maybe somebody a nice suggestion :-)
>
> Artur
>
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
>
http://lists.wfu.edu/mailman/listinfo/gretl-users
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
--
For global instant messaging use the free and transparent Jabber chat:
t.artur(a)cryptolab.net
Avoid Facebook and join me on Diaspora:
https://despora.de/i/9fba3608d45a
If you want to use encrypted emailing, here is my public PGP key:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mQINBFIFGVsBEACc0QWXQ8fij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