Le vendredi 28 novembre 2014 à 22:50 -0800, John Myles White a écrit :
> There is no matrix in Julia that satisfies the constraint that one
> column is all integers, another column is all integers and the last is
> all floats, because all matrices in Julia have a homogeneous type.
>
> There are several possible solutions:
>
> (1) Use Array{Any} and then enforce your constaints by hand.
>
> (2) Use Array{Vector} and store the columns as the entries of an array of
> columsn.
>
> (3) Allow all columns to be floats.
Why don't you mention the fourth solution, that is use a DataFrame?
Depending one's the objectives, it may be a good solution.
Regards
> — John
>
> On Nov 28, 2014, at 10:39 PM, Kenan KARAGÜL <[email protected]> wrote:
>
> > Hi everyone,
> > Could you help me any one about this subject.
> >
> > A=rand(2,3)
> > 2x3 Array{Float64,2}:
> > 0.650875 0.0649599 0.320412
> > 0.801777 0.633312 0.271399
> >
> > a,b,C=findnz(A)
> > ([1,2,1,2,1,2],[1,1,2,2,3,3],[0.650875,0.801777,0.0649599,0.633312,0.320412,0.271399])
> >
> > I want to get this matrix
> > [a b C] --> [Int64 Int64 Float64]
> > 1 1 0.650875
> >
> > 2 1
> > 0.801777
> >
> > 1 2
> > 0.0649599
> >
> > 2 2
> > 0.633312
> >
> > 1 3
> > 0.320412
> >
> > 2 3
> > 0.271399
> > but I can get [a b C] -->[Float64 Float64 Float64]
> > 1.0 1.0 0.650875
> > 2.0 1.0 0.801777
> > 1.0 2.0 0.0649599
> > 2.0 2.0 0.633312
> > 1.0 3.0 0.320412
> > 2.0 3.0 0.271399
> >
> > Thank you in advance
> >