Re: [Scilab-users] Matrix: mix string and float

2016-03-04 Thread sgougeon
Hello,

>De: "anna78"  4 Mars 2016 14:45:10
>.../...
>Is it possible to build a matrix with different element types?

This is called a cell array. 
In your case, since each column is homogeneous, you may as well store the 13 
matrices simply in a list: M = list(M1,M2,..,M13).
The most appropriate container -- cell array or list -- depends on which kind 
of operations you wish to do afterwards with M's components.

HTH
Samuel Gougeon
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Matrix: mix string and float

2016-03-04 Thread Serge Steer

example
M1=(1:15)';M2="foo"+string(M1);M3=sin(M1/10);
M=tlist("cblock",M1,M2,M3)

M(1:2,:)
M(:,1) //the result is a standard array of numbers
M(:,2) //the result is a standard array of strings

This kind of data structure can be obtained directly reading a data file 
with mfscanf

with the attached file
u=mopen("foo1")
M=mfscanf(-1,u,"%d %s %f\n")
mclose(u)


One can also use the cell array
M=cell(1,3);
M.entries(1)=M1;
M.entries(2)=M2;
M.entries(3)=M3;

This solution will be more simple under Scilab 6
M1=(1:15)';M2="foo"+string(M1);M3=sin(M1/10);
 M={M1,M2,M3}
M{:,1}//the result is a standard array of numbers
Le 04/03/2016 14:45, anna78 a écrit :

dear all,

I have 13 column vectors: M1, M2,  M13.
One is an integer /%d) vector, two are string (%s) vectors, the others are
double (%f).

I would like to build the matrix M=[M1 M2 M3... M13], but it looks like not
working.

Is it possible to build a matrix with different element types?

thanks
Anna



--
View this message in context: 
http://mailinglists.scilab.org/Matrix-mix-string-and-float-tp4033620.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



1 a  0.2
2 b  -0.5
3 c 33
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Matrix: mix string and float

2016-03-04 Thread anna78
dear all,

I have 13 column vectors: M1, M2,  M13.
One is an integer /%d) vector, two are string (%s) vectors, the others are
double (%f).

I would like to build the matrix M=[M1 M2 M3... M13], but it looks like not
working.

Is it possible to build a matrix with different element types?

thanks
Anna



--
View this message in context: 
http://mailinglists.scilab.org/Matrix-mix-string-and-float-tp4033620.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users