If you didn't mind boxing instead of a matrix you can capture the difference 
between indexing and null indicators this way.

     I.@:(5&=)each 1 2 3 4; 2 3 4 5; 5 4 3 2 ; 2 3 5 4
┌┬─┬─┬─┐
││3│0│2│
└┴─┴─┴─┘

Cheers, bob

> On Jan 13, 2019, at 10:06 AM, Jimmy Gauvin <[email protected]> wrote:
> 
> Hi,
> 
> does this help :
> 
>   5 e."1 |:1 2 3 4,. 2 3 4 5,. 5 4 3 2 ,. 2 3 5 4
> 0 1 1 1
> 
> 
> 
> On Sun, Jan 13, 2019 at 12:56 PM 'Skip Cave' via Programming <
> [email protected]> wrote:
> 
>> I know I can find the location (index) of a specific integer in a vector of
>> integers using I.
>> 
>> I.5=1 2 3 4 5 4 3 4 5 6 5 6
>> 
>> 4 8 10
>> 
>> 
>> So I want to find the row index of a specific integer in an array of
>> integers:
>> 
>> |:1 2 3 4,. 2 3 4 5,. 5 4 3 2 ,. 2 3 5 4
>> 
>> 1 2 3 4
>> 
>> 2 3 4 5
>> 
>> 5 4 3 2
>> 
>> 2 3 5 4
>> 
>> 5=|:1 2 3 4,. 2 3 4 5,. 5 4 3 2 ,. 2 3 5 4
>> 
>> 0 0 0 0
>> 
>> 0 0 0 1
>> 
>> 1 0 0 0
>> 
>> 0 0 1 0
>> 
>> ,I. 5=|:1 2 3 4,. 2 3 4 5,. 5 4 3 2 ,. 2 3 5 4
>> 
>> 0 3 0 2
>> 
>> 
>> The first zero indicates that there is no 5 in the first row. The second
>> zero gives the index of the 5 in the third row. How can I tell whether the
>> zero is an index, or a null indicator?
>> 
>> Skip
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to