problem with code - deleting rows and columns from matrix

Status
Not open for further replies.

majida

Newbie level 2
Joined
Aug 18, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
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
 

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?
 

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
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…