How to extract data from multiple excel files

I am attempting to create a 3D map of 101 sets of data, each set is in a seperate excel spreadsheet, all sets are within 1 folder.
My MatLAB knowledge is minimal, but this is my attempt at the code:
nFiles=101
filenamePrefix='F1--Trace-no loop-0000--0000';
filenameExtension='.csv';
for i = 1:nFiles
filename = [filenamePrefix, int2str(i), filenameExtension];
tmpData = readmatrix(filename, 'NumHeaderLines',1)
x{i}=tmpData(:,1);
y{i}=tmpData(:,2);
end
mesh(x{i},y{i},i}
Please give any advice or alternative codes that could work

댓글 수: 1

"create a 3D map of 101 sets of data, "
Can you explain precisely what the end result wanted is and what the data are/how they relate to the desired result?
As to alternatives, I'd probably start with something like--
d=dir('F1--Trace-no loop-0000--0000*.csv'); % return all files
for i=numel(d)
tmpData = readmatrix(d(i).name, 'NumHeaderLines',1);
...
It's what's next that depends on what it is wanting to do with the data and what it is that the data are.

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

답변 (1개)

Samatha Aleti
Samatha Aleti 2019년 8월 19일

0 개 추천

You may find the relevant answer here

카테고리

질문:

2019년 8월 13일

답변:

2019년 8월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by