+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 2
    Points: 600, Level: 5

    Join Date
    Aug 2009
    Posts
    2
    Helped
    0 / 0
    Points
    600
    Level
    5

    problem with code

    hi,

    i m facing problem with code, actually
    if have a matrix of any dimension , i have any whole row and whole column zero in a matrix and want to delete this row n column from this matrix but im unable to understand how to delete this row n column i.e. i should get the matrix with reduced dimension



    b is a matrix of "n" dimensions
    and supppose its 2nd row n 2nd column is zero i want to delete this whole row and column

    for i=1:n
    for j=1:n

    if find(b(i,j)~=0)

    table(i,j)=b(i,j);

    else
    continue

    end
    end

    end



    thanks

    •   Alt25th August 2009, 06:31

      advertising

        
       

  2. #2
    Advanced Member level 4
    Points: 15,471, Level: 30
    Aya2002's Avatar
    Join Date
    Dec 2006
    Location
    Iraq
    Posts
    1,142
    Helped
    406 / 406
    Points
    15,471
    Level
    30

    problem with code

    I can not understand you. Your program say that any value not equal to zero will be copied to table(i,j), what do you need exactly?



    •   Alt25th August 2009, 14:22

      advertising

        
       

  3. #3
    Newbie level 2
    Points: 600, Level: 5

    Join Date
    Aug 2009
    Posts
    2
    Helped
    0 / 0
    Points
    600
    Level
    5

    Re: problem with code - deleting rows and columns from matri

    i,ve solved the problem sorry i couldnt explain it well i had to delete entire row n column frm a matrix i just equate that particular row n colum to [] and got the required result



--[[ ]]--