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

Reply via email to