필터 지우기
필터 지우기

multiple .csv file importing (different row numbers of each file) from a folder

조회 수: 7 (최근 30일)
Hi,
I have 100+ .csv files in a folder. Each .csv file has 18 columns and various row numbers. I want to import data from all .csv files from that folder to create a 3-d matrix where the third dimension will be the number of .csv files. Can someone please help me in this regard?
Also, some .csv file has few blank cells. I want to delete those rows and shift bottom rows up while processing those .csv files to create 3-d matrix.

채택된 답변

KSSV
KSSV 2018년 5월 16일
편집: KSSV 2018년 5월 16일
files = dir('*.csv') ; % You are in the folder of csv files
N = length(files) ; % total number of files
iwant = cell(N,1) ; % cell because csv files have different rows
% loop for each file
for i = 1:N
iwant{i} = csvread(files(i).name) ;
end
  댓글 수: 5
Mudasser Seraj
Mudasser Seraj 2018년 5월 17일
@KSSV have you figured out a way to do that?

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by