[scilab-Users] matrix values extraction

Calmon Martin martin.calmon at epfl.ch
Tue Jan 25 15:47:57 CET 2011


Dear JD,

I will not take the time now to get into detail... But I think you should use Matlab/Reshape ie Scilab/Matrix, work with all your data in a row and subsequently transform your indices to keep.

Bests,

Martin CALMON
EPFL/STI/IGM/LMH
Assistant
+41 (0)21 69 32502
+41 (0)78 65 75020
________________________________________
De : Jean-Damien Capdeville [jdcapdeville at gmail.com]
Date d'envoi : mardi 25 janvier 2011 15:32
À : users at lists.scilab.org
Objet : [scilab-Users] matrix values extraction

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


More information about the users mailing list