Reading cells extension wise in matlab.

1 vue (au cours des 30 derniers jours)
Anurag Pujari
Anurag Pujari le 8 Juin 2013
how to read the excel cells according to extension wise and how to count them? Foe an example, if I have this column
q.txt
w.txt
e.txt
r.exe
t.exe
and I want to count the number of txt file names as well as number of exe file names in the sheet. How to do so?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 8 Juin 2013
Modifié(e) : Azzi Abdelmalek le 8 Juin 2013
A={'q.txt';'w.txt';'e.txt';'r.exe';'t.exe';'k.xls';'m.xls'}
% xls files
out_xls=A(cellfun(@(x) ~isempty(strfind(x,'.xls')),A))
% Number of txt file
nuber_txt=sum(cellfun(@(x) ~isempty(strfind(x,'.txt')),A))
  1 commentaire
Anurag Pujari
Anurag Pujari le 9 Juin 2013
Thank you sir. It worked.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by