remove first element in cell and do not change index of other element
1 次查看(过去 30 天)
显示 更早的评论
I have A, and want to remove first index from remain index
A={[1,2,3],[2,6,8,7],[4,5,6,7,8,9,10]};
first_index=cellfun(@(v) find(v(1)),A,'uni',0);
remain_index=cellfun(@(v) ~ismember(v(1),v),A,'uni',0); % I have problem in this part
result should be
first_index={[1],[1],[1]};
remain_index={[2,3],[2,3,4],[2,3,4,5,6,7]} % remove first index
0 个评论
采纳的回答
dpb
2019-8-10
You're overthinking the problem...the first index is always 1...
>> cellfun(@(a) 2:numel(a),A,'uni',0)
ans =
1×3 cell array
{1×2 double} {1×3 double} {1×6 double}
>> ans{:}
ans =
2 3
ans =
2 3 4
ans =
2 3 4 5 6 7
>>
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!