문제

I need a way to open all the files in a folder, regardless of the filename. All the files have a .csv extension.

도움이 되었습니까?

해결책

You could use listfiles and csvRead like this

function doSomethingWithCSVdata(CSV_data)
    disp(CSV_data);
endfunction

csv_files = listfiles('*.csv');

for i=1:size(csv_files,1)

    disp('Opening file: '+csv_files(i))
    csvData = csvRead(csv_files(i),ascii(9), [], 'string');

    doSomethingWithCSVdata(csvData);
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top