[Scilab-users] getting the first column number of each row

Pierre-Aimé Agnel pierre-aime.agnel at scilab-enterprises.com
Mon Nov 30 10:33:19 CET 2015


Hi,

You can do:
x = rand(10, 10);
tmp= zeros(10, 10);
tmp( find(x > 0.5) ) = 1;
[max_tmp, y] = max(tmp, "r");
//y holds the indices of the first row where tmp is at max value

Hope this helps

Best regards

Le 30/11/2015 06:54, fujimoto2005 a écrit :
> I want to get the first column number of each row with %T.
> Now I use loop as follows.
>
> x=rand(10,10);
> for i=1 :10
> 	y(i)=min(find(x(i,:)>0.5);
> end
>
> Is there any way to get  y without using 'for end' loop because it will take
> a time when row number is large .
>
> Best regards.
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/getting-the-first-column-number-of-each-row-tp4033132.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 
Pierre-Aimé Agnel
R&D Projects Manager
Phone:  +33.1.80.77.04.67
Mobile: +33.6.82.49.35.23
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.60
http://www.scilab-enterprises.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20151130/c03972c4/attachment.htm>


More information about the users mailing list