Snip.m Snip elements out of vectors/matrices

버전 1.3.0.0 (3.39 KB) 작성자: Nicolas
Solves problems s.a. 'remove all nan' from a vector, 'get rid of 14th row of matrix' with low effort
다운로드 수: 2.2K
업데이트 날짜: 2013/9/16

라이선스 보기

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.

인용 양식

Nicolas (2024). 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. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.3.0.0

13. Sept. 2013: Included inf and i/j as possible arguments to remove infinity and complex elements, too.

1.1.0.0

corrected 'end' to 'last', as end was obviously interfering with standard instruction.

1.0.0.0