Find consecutive ones and save the contents

1 次查看(过去 30 天)
Hi,
indcol1 = ind(:,1); % the indexes
indcol2 = ind(:,2); % the array of 1 and 0
Thank you in advance!

采纳的回答

David Hill
David Hill 2022-3-17
s=num2str(ind6(:,2)');
s=s(s~=' ');
[Start,End]=regexp(s,'[1]{2,}');
for k=1:length(Start)
c{k}=ind6(Start(k):End(k),1)';
end

更多回答(1 个)

Matt J
Matt J 2022-3-17
编辑:Matt J 2022-3-17

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by