help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find minimum non-zero


From: Markus Mützel
Subject: Re: find minimum non-zero
Date: Thu, 14 Nov 2019 17:02:38 +0100

Am 14. November 2019 um 16:48 Uhr schrieb "gigiolone123 via Help list for GNU 
Octave":
> Sorry
> I committed an inaccuracy
>
> i want to find the first number (non zero) in each row
>
>
>  example:
>
>      1   0   0   8   7   0   0   2
>      0   0   0   0   0   0   0   0
>      2   0   0   6   0   0   1   0
>
> ans: 1 0 2
>
> another example:
>
>      0   0   0   8   7   0   0   2
>      0   0  3   0   0   0   0   0
>      5   0   0   6   0   0   1   0
>
> ans: 8 3 5
>

There are probably several possible solutions. One involves meshgrid, logical 
indexing and min.
But you should do your homework on your own.

Markus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]