[scilab-Users] matrix values extraction
Frédéric Mabille
mabille at supagro.inra.fr
Tue Jan 25 15:59:28 CET 2011
and other idea is :
diag( a ( : , c ( : ) ) )
fred
Le 25 janv. 2011 à 15:32, Jean-Damien Capdeville a écrit :
> Dear all,
>
> I'm looking to extract from a matrix "A" one value for each line. The column
> positions of the value to extract would be given by a vector "c".
>
> Here is an example:
> A = [ 1 2 3 ; 4 5 6 ; 7 8 9 ; 10 11 12 ; 13 14 15 ]
>
> c = [ 3 ; 1 ; 1 ; 2 ; 3 ]
>
> How can I get the resulting vector [ 3 ; 4 ; 7 ; 11; 15 ] ?
>
> I'm currently using a loop which is obviously a time expensive solution with
> large matrix.
> Any ideas to get it more efficiently?
>
> Thanks,
>
>
> Jean-Damien
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20110125/2b4b11d4/attachment.htm>
More information about the users
mailing list