Skip to main content
8-Gravel
September 23, 2018
Solved

Delete elements from columne vectors

  • September 23, 2018
  • 1 reply
  • 2830 views

Hi!
I have written a function i call "STACK(A)" that takes a column vector, and loops through it and stacks all non zero elements in a new column vector. 

 stack.PNG
My problem is the output, the new column vector is displayed as:

result.PNG

Any suggestions on how to get a new normal column vector like the "IntendedOutput"

Regards 😄 
Sigurd 

This topic has been closed for replies.
Best answer by Werner_E

Simply omit the "stack" command and you get the output you expect!

Find also some less elaborate routines below - their output differs if the input vector consists of zeros only!

B.png

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
September 23, 2018

Simply omit the "stack" command and you get the output you expect!

Find also some less elaborate routines below - their output differs if the input vector consists of zeros only!

B.png