Skip to main content
1-Visitor
January 28, 2011
Question

Unstack/delete rows/columns

  • January 28, 2011
  • 1 reply
  • 7449 views

New Picture (9).jpg

How can I delete (in a programme) rows in a matrix which has all the elements in the forementioned rows equal to zero?

Furthermore, is it possible to extract the positions (in a matrice) for elements meeting a condition (i.e. my "Position1" checks for each column if there is an element meeting that condition; if it is, it's position becomes the new value ~ element = row no. The end to that is that there are many rows with "zero" as elements and I need to delete them to get a new matrice - i.e. starting with row 36 to the last ~ no change in no of colums assuming in each row there is an element meeting the condition. Should also that not be the case is it possible to further eliminate columns?)

Kind regards, Dumitru

P.S. "Position20" calculates correctly the value for which there are the most lines of non-zero elements. Still I can't seem to subtract the needed matrice ~ "Position22" (incorrect no of rows and columns)...

New Picture (10).jpg

1 reply

1-Visitor
January 28, 2011

Could you post a worksheet? It will be much more helpful


Mike

http://communities.ptc.com/servlet/JiveServlet/showImage/2-149416-2532/bar_anim.gif

Dumitru1-VisitorAuthor
1-Visitor
January 28, 2011

I managed in the end to get it done...still the question remains.."is it another way easier" and "what about deleting columns and extracting their no in the original matrice"

23-Emerald V
January 28, 2011

Dumitru Moldovan wrote:

I managed in the end to get it done...still the question remains.."is it another way easier" and "what about deleting columns and extracting their no in the original matrice"

Dumitru,

Unfortunately, your worksheet isn't working correctly in my M11 (I think I've got a set up problem). However, regarding your original request, the attached worksheet shows one way to identify all-zero rows and columns and then use that information to delete those rows/columns (or, rather, construct arrays that leave them out).

Stuart