Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to divide a cell into two groups based on two types of strings
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a cell, say 20 by 1, which looks like below (ignore the 879). Each one in a cell is a string such as 'bad1.png'.
As you can see, some has the suffix of '.png' and some has the suffix of '.jpg'.
How can I separate them into two groups with one group only contains '.png' and the other group only contains '.jpg'?
Thanks!
0 个评论
回答(1 个)
Ameer Hamza
2018-6-3
Try this
index = contains(names, '.png'); % nemes is your cell array
pngFiles = names(index);
jpgFiles = names(~index);
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!