how to take reference of the previous row data for the next row

Discussion in 'MATLAB' started by rahul panchal, Apr 11, 2008.

  1. I am reading 100s of csv files in Matlab. all files have
    3 columns and m rows. I am taking one of them (Time) and I
    have to make one matrix (MeltT) having one column (and m
    rows)using certain formula.
    Note; value of m (no. rows) are different for different
    csv files.

    for first cell or first row of the MeltT
    i.e. MeltT(1,1)= TMelt (constant).
    and then from Melt(2:m,1) ineed to use following equation.
    MteltT = (4*(Tmelt-Tmold))*(1./(P1))+ Tmold
    where Tmelt for next row will be the value of the previous
    row
    I am trying following code
    [m,1] = MeltT
    size(MeltT)

    for i = 1:m

    MeltT(1,1) = Tmelt

    MeltT(i+1)= (4*(MeltT(i,1)-Tmold))*(1./(P1))+ Tmold;

    end

    please some one help me out to correct my code.
     
    rahul panchal, Apr 11, 2008
    #1
    1. Advertisements

  2. rahul panchal

    Randy Poe Guest

    What's wrong with it?

    - Randy
     
    Randy Poe, Apr 11, 2008
    #2
    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.