convert matrix to vectors or vectors to matrix

Discussion in 'MATLAB' started by Carine Simon, Jan 23, 2005.

  1. Carine Simon

    Carine Simon Guest

    Hi,
    I wanted to know if there were built-in Matlab functions to do that?

    Thanks a lot,

    Carine
     
    Carine Simon, Jan 23, 2005
    #1
    1. Advertisements

  2. Carine Simon

    Dan Hensley Guest

    help reshape

    Dan
     
    Dan Hensley, Jan 23, 2005
    #2
    1. Advertisements

  3. To convert a matrix A to a vector, simply type
    A:))

    For more general conversion, check the reshape function

    /Johan
     
    Johan Carlson, Jan 23, 2005
    #3
  4. Yes it has

    % Some examples
    Matrix=randn(10,15);
    Vector=Matrix:));
    Vector=reshape(Matrix,10*15,1);
    or use
    Matrix=reshape(Vector,10,15);

    To repate values use repmat

    BR
    Anders
     
    Anders Björk, Jan 23, 2005
    #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.