get a subcell from a bigger cell
5 次查看(过去 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 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!