Reading cells extension wise in matlab.

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?

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 6 月 8 日
編集済み: Azzi Abdelmalek 2013 年 6 月 8 日

1 投票

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 件のコメント

Anurag Pujari
Anurag Pujari 2013 年 6 月 9 日
Thank you sir. It worked.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by