From: Andy on 8 Jan 2010 14:50 "Sean Takai" <stakai(a)ucsd.edu> wrote in message <hi81mq$hse$1(a)fred.mathworks.com>... > Hi all, > > I know this is pretty simple but I can't get it to work right. > > Say I have a matrix A = [1 2 3; 4 Inf 6; Inf 8 Inf] > > and I want try to remove the Inf values from a given column, what would be the best way to do so while preserving the original number values? > > I know about B = A(:,2) ~= Inf > > B = > > 1 > 0 > 1 > > But is there a similar way to do the same while keeping the original values while also deleting the 0 completely? > > Thanks for any help. If you think about it, what you're asking doesn't make sense. You would be shrinking some rows of the matrix and not others, effectively forcing the matrix dimensions to not line up properly. You should think about just checking for a flag value while processing your matrix. Use the isinf command to check for plus or minus infinity: A(isinf(A))=0; % sets all Infs to 0 This isn't quite what you asked, but you can tailor it to your needs.
|
Pages: 1 Prev: Newbie mvregress Next: viewing a plane down it's normal vector |