delete the first n elements of each cell
1 ビュー (過去 30 日間)
表示 古いコメント
Given cell a, how to delete the first n elements of each cell? I am now using for loop. However, when the loop is big (5021889 loops), this line can be very slow.
May I know if there is a faster version or vectorized version of this?
Thank you
a=cell(2,1);
a{1,1}=1:10;
a{2,1}=1:10;
b=[3,8];
for i=1:2
a{i,1}(1:b(i))=[];
end
0 件のコメント
採用された回答
Stephen23
2018 年 5 月 3 日
I doubt that there is a much faster way, because what you are doing resizes the arrays themselves. cellfun will likely be slower.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!