Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
How to divide a cell into two groups based on two types of strings
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190993/image.png)
0 Kommentare
Antworten (1)
Ameer Hamza
am 3 Jun. 2018
Try this
index = contains(names, '.png'); % nemes is your cell array
pngFiles = names(index);
jpgFiles = names(~index);
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!