get a subcell from a bigger cell
조회 수: 8 (최근 30일)
이전 댓글 표시
I have a cell of 10x9 named 'a', each index contains a string. How can i create a sub cell if i have two vectors (f,c) with the indexes that i want. e.g. imagine a 2x3 cell a and indexes f and c
a={('this'), ('is') ,('big');('he') ,('buys') ,('it')}
f=[1,1,2];
c=[1,2,3];
the result i want is b={('this'), ('is');('it'),('')}
댓글 수: 3
답변 (1개)
Guillaume
2018년 2월 5일
Use ind2sub:
a(ind2sub(size(a), f, c))
The result will be 1x3 vector not an arbitrary sized array.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!