Find consecutive ones and save the contents

2 ビュー (過去 30 日間)
Nina Perf
Nina Perf 2022 年 3 月 17 日
編集済み: Nina Perf 2022 年 3 月 17 日
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 Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by