[scilab-Users] matrix problems

Cordero R. rcorderog at gmail.com
Tue Mar 4 15:31:05 CET 2008


Hi
You could create a program for that.
First, you should get the size of the matrix with the command size:
[m,n]=size(A). Now you know the number of rows and columns.
Second,  create a zero vector with the command zeros: B=zeros(m*n,1)
Third, use  for loops:
for j=1:n
    for i=1:m
         B( m*(j-1)+i )=A(i,j);
    end
end

Raymundo
CIEEP-Perú

2008/3/4, Maso Ricci <ricci2 at unisi.it>:
>
> Hi all,
> I am trying to figure out how scilab works... and I was wondering
> whether exists a way to convert a matrix data such as:
>     1.00000000000000       0.750689539248839       0.575450038685058
>   0.447770887731725       0.352291666599128       0.279493780281873
>   0.223164527313716       0.179078852155991       0.144266830446559
>   0.116583838853294       9.444665661607855E-002  7.666507867378637E-002
>   6.233082044030214E-002  5.074212100141323E-002  4.135119889501301E-002
>   3.372683743749021E-002  2.752720834623435E-002  2.247977865706249E-002
>   1.836623314137826E-002  1.501100449134708E-002  1.227245029959649E-002
>   1.003599544250727E-002  8.208760050464130E-003  6.715317087929489E-003
>   5.494323561688932E-003  4.495830903612723E-003  3.679128994505069E-003
>   3.011009827960343E-003  2.464368355490481E-003  2.017068214989182E-003
>   1.651023060847658E-003  1.351450402154765E-003  1.106264213952365E-003
>   9.055809291743580E-004  7.413163523581016E-004  6.068569673468328E-004
>   4.967917877191485E-004  4.066930964362238E-004  3.329375168798268E-004
>   2.725596626647907E-004  2.231324821751473E-004
>
>
> to a column-wise data like:
>
> 1.0000000000000
> 0.750689539248839
> 0.575450038685058
> 0.447770887731725
> 0.352291666599128
> 0.279493780281873
>
> [ . . .]
>
> thanks
>
>
>
>
> --
>
> Maso Ricci Ph.D
> Dept. of Chemical and Biosystem Science
> University of Siena
> Via A. Moro, 2 ­ 53100 Siena
> ITALY
> Tel: +39 0577 234367
> Fax: +39 0577 234177
> email: ricci2 at unisi.it
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20080304/8543b2d2/attachment.htm>


More information about the users mailing list