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
Regards
Punter

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..??

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):
        mylist.append(4)
    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):
    
        obj.append(make_list(cols))
    return obj

obj = make_matrix(3, 3)

print(obj)


try:
    file = open("mat.obj", "wb")
    cPickle.dump(obj, file)
    file.close()
except IOError, message:
    print message
    sys.exit(1)

try:
    file = open("mat.obj", "rb")
    obj = cPickle.load(file)
    file.close()
except IOError, message:
    print message
    sys.exit(1)

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
Regards
punter

This question has already been answered. Start a new discussion instead.