You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
I often end up having to remove certain elements from a vector, or I don't need certain lines from my data and similar problems. While matlab has great matrix manipulation capability, I find myself continuously forgetting which [(:,)):,) combination would do the trick nicely and then proceed to Google. Therefore, my first attempt at creating something useful turns matlab logic upside down: Imagine your vector is on a strip of paper, and you cut out all the unwanted nan's. Then paste the rest together. Same with matrices. Also works with specifying the rows and columns to get rid of etc.
This aim is to remove large accumulations of logical index descriptions (bracket-clusters) and provide an easy command instead:
snip(input,snipthis)
While it is not perfect (written in a flurry), it worked for me so far - so please provide feedback to make it better. It should work with everything necessary, except self-defined data-structures.
Cite As
Nicolas (2026). Snip.m Snip elements out of vectors/matrices (https://www.mathworks.com/matlabcentral/fileexchange/41941-snip-m-snip-elements-out-of-vectors-matrices), MATLAB Central File Exchange. Retrieved .
Acknowledgements
Inspired: Circles overlap remover
General Information
- Version 1.3.0.0 (3.39 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
