matlab data file of matix to normal matix format

Discussion in 'MATLAB' started by fanny, Jun 23, 2006.

  1. fanny

    fanny Guest

    Hi,
    I have a question regarding matrix in Matlab--

    Let say, there is a Matlab data file as:
    A =
    (1,1) 0.5
    (2,1) 0.6
    (3,1) 0.7
    (1,2) 0.8
    (2,2) 0.9
    (3,2) 1.0

    However, I want the matrix A to be displayed as:
    0.5 0.8
    0.6 0.9
    0.7 1.0

    of course, the nomral way to create a matix is to type the following:
    A = [0.5 0.8
    0.6 0.9
    0.7 1.0]

    Therefore, my question indeed is to convert the matlab data file to
    the form of creating a matrix.

    Indeed I am using Matlab to do some processing of texts and ceate
    term-document matics. The outpust turn out to be the matlab data
    file, and its size is indeed very large. I need to have this matix in
    the
    data file to be displayed a s a normal matrix ( vector), but not in
    the
    form as that in the data file.

    THANK YOU
     
    fanny, Jun 23, 2006
    #1
    1. Advertisements

  2. fanny

    Jérôme Guest

    Hi,

    what do you mean by "Matlab data file" ?
    Is it an ascii file ?

    Jérôme
     
    Jérôme, Jun 23, 2006
    #2
    1. Advertisements

  3. I can't really follow your question. But I can give some
    information. The first matrix A you show is in sparse form. If you
    like, you may convert it to a full matrix, where it will display like
    you want it to:

    B = full(A);

    I'm lost when you talk about MATLAB data file. Do you mean variable?
     
    Peter Boettcher, Jun 23, 2006
    #3
  4. fanny

    fanny Guest

    Thank you for all you advice. I did what Peter suggested, and I get
    the matix displayed. Thank you again.

    Sorry I am new to Matlab. Matlab data file (.mat)is just the property
    of the file storing matix A in its space form.
     
    fanny, Jun 23, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.