필터 지우기
필터 지우기

How to load multiple csv files and save them after converting into arff files?

조회 수: 2 (최근 30일)
Hello Friends,
I have several csv files, all stored in path 'C:\Users\Name\Documents\MATLAB\*.csv'. I want to loop one by one each file in order, convert them into arff files, and save them 'C:\Users\Name\Documents\MATLAB\*.arff'

채택된 답변

Walter Roberson
Walter Roberson 2015년 6월 10일
datadir = 'C:\Users\Name\Documents\MATLAB';
d = dir(fullfile(datadir, '*.csv'));
for i=1:length(d)
filename = fullfile(datadir, d(i).name);
  댓글 수: 5
Stephen23
Stephen23 2015년 6월 11일
편집: Stephen23 2015년 6월 11일
It would be much more robust to use regexprep rather than indexing and string concatenation, something like this:
>> name = 'MyFile.csv';
>> regexprep(name,'\.csv$','.arff')
ans =
MyFile.arff

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by