How do i make matlab diferentiate words in cell array

'12100213.csv' '12100214.csv' '12100215.csv' '12100216.csv' '12113013.txt' '12120423.txt' '12120516.txt' ....
This is my cell array and i want to make matlab make the difference between csv and txt files so i can upload them differently.
thank you

 채택된 답변

Voss
Voss 2023년 1월 11일
C = {'12100213.csv' '12100214.csv' '12100215.csv' '12100216.csv' '12113013.txt' '12120423.txt' '12120516.txt'};
[~,~,ext] = fileparts(C)
ext = 1×7 cell array
{'.csv'} {'.csv'} {'.csv'} {'.csv'} {'.txt'} {'.txt'} {'.txt'}
isCSV = strcmp(ext,'.csv')
isCSV = 1×7 logical array
1 1 1 1 0 0 0
isTXT = strcmp(ext,'.txt')
isTXT = 1×7 logical array
0 0 0 0 1 1 1

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2023년 1월 11일

답변:

2023년 1월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by