for loop into new array?

Discussion in 'Programmer's Corner' started by Judas543, Apr 28, 2010.

  1. Judas543

    Thread Starter Member

    Jan 26, 2010
    60
    0
    for r=1:length(raw)
    extractedRow=raw(r, : )

    if (sum(isnan(raw{r,1})))==1||(sum(isnan(raw{r,2})))==1||(sum(isnan(raw{r,3})))==1||(sum(isnan(raw{r,4})))==1
    if errorReview{1}==0;
    errorReview=extractedRow;

    else
    errorReview=vertcat(errorReview,extractedRow);


    end
    end
    end

    Basically it takes out all of the nans and puts them into errorReview, however I'm wondering how to copy the valid entries without the nans into a new array.
     
    Last edited: Apr 28, 2010
  2. johndoe45

    Member

    Jan 30, 2010
    364
    1
    like i said in isempty thread you posted.
    instead of
    find(array==0)
    put
    find(array~= 0) % i think that is the not equal to function
     
  3. Judas543

    Thread Starter Member

    Jan 26, 2010
    60
    0
    yea ur right thank you very much
     
Loading...