Interchanging Columns and Rows in a Matrix Imported from Excel

Discussion in 'MATLAB' started by Stephen Molnar, Jul 23, 2006.

  1. I am a new user and have what I hope is a trivial problem.

    I need to model data from a Raman spectrophotometer. The spectra are
    in an Excel spreadsheet of 11 columns and 1784 rows. This results,
    of course, in a 1784X11 matrix in MATLAB. Unfortunately, the model
    that I am attemping to impliment requires a 11X178a matrix. How do I
    accomplish the transformation. Excel doesn't have enough colums to
    transpose the matrix before importing to MATLAB.

    Alternately, the OMNIC software (spectrometer software) allows me to
    save individual spectra as a 2 column by 1784 row ascii file. Is it
    possible to import just the second column, the intensity data (the
    first column is the frequency shift data and is the same for all of
    the spcetra in a set) as a row in the resulting MATLAB matrix and
    then add each successive spectrum as the next row in the MATLAB

    Thanks inadvance
    Stephen Molnar, Jul 23, 2006
    1. Advertisements

  2. Stephen Molnar

    Fred Guest

    Transposing a matrix in matlab is very simple.
    Original matrix: A
    Transposed matrix: A'

    Since you are obviously new to Mablab, try for example the
    following code to understand what I mean.

    A = rand(2,5)
    A = A'

    Fred, Jul 23, 2006
    1. Advertisements

  3. Thanks, Fred.

    I think that I have just redefined trivial.
    Stephen Molnar, Jul 23, 2006
    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.