hello seniors,

i want to serialize a matrix of any dimension to be serialized and stored in the hard.i will be thankful if you guide me about this.how can i perform this work..?

your response and help will appreciated

Recommended Answers

All 8 Replies

You may want to look into the Python module pickle.

thank you for reply..
i have solved that issue after spending some time on that.

but now i want to know how can i get a matrix from a excel like grid showing only those values from the grid in which some value exist.
means it should not display the zeros that are present in other fields(columns,rows) are available...only show the that matrix where some real value like 1,2,3....etc exist.....

can you guide me in that..??

Is that data in CSV format?

no it is an excel like spread sheet.
i want to get only those values from the grid which are real numbers like 1,2,3,4,.....these values should store in the form of matrix which could be serialized than to store on the hard as a intermediate object file.

i am still stuck with that issue can you help me?
i will be thankful...

ok.i am going to check it out the link that you have sent me.i hope that it will help me ..thank you.

i have checked that link that you have sent me,but it is not providing any example or way by which i can serialize a matrix and store it as an intermediate object.i will extremely thankful for your help if you guide me in this issue.badly stuck in that.
here is the code.

import cPickle, sys

def make_list(size):
    """create a list of size number of zeros"""
    mylist = []

    for i in range(size):
    return mylist

def make_matrix(rows, cols):
    create a <strong class="highlight">2D</strong> <strong class="highlight">matrix</strong> as a list of rows number of lists
    where the lists are cols <strong class="highlight">in</strong> size
    resulting <strong class="highlight">matrix</strong> contains zeros
    obj = []
    for i in range(rows):
    return obj

obj = make_matrix(3, 3)


    file = open("mat.obj", "wb")
    cPickle.dump(obj, file)
except IOError, message:
    print message

    file = open("mat.obj", "rb")
    obj = cPickle.load(file)
except IOError, message:
    print message

the above code makes a matrix from list and store an intermediate object on hard drive.i want to get the matrix from the grid and store only those in the matrix which are real numbers.i hope you get my point.i will be waiting for your reply.thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.