Reading data from multiple excel files

1 回表示 (過去 30 日間)
Hamza Brk
Hamza Brk 2021 年 3 月 24 日
編集済み: TS 2021 年 3 月 24 日
Hello, I have a folder containing 15 excel files. Each file represents data of 3 audio signals. I want to read all these files and draw all signals on the same plot.

回答 (1 件)

TS
TS 2021 年 3 月 24 日
編集済み: TS 2021 年 3 月 24 日
I'm actually doin something like this.
First define the directory:
pathData = 'C:\...\';
If you just want to use CSV data use
fileEnding = '*.csv';
and merg them together (u could do this in one line if u want to save space)
audioData = [pathData,fileEnding]
then load the data names into a file, and if u want, creat a list just of the file names
liste_audioData = dir(audioData);
files_audioData = {liste_audioData.name}';
then read each file in a for loop for as much files you have and cut them as needed
for i = 1:size(files_audioData)
name_audioData = files_audioData{i};
data = readtable(name_audioData);
data(1:14,:) = [];
data(end,:) = [];
end
to excess the data use
Value(:,i) = data.'columnname'
and then simple
plot(time,Value(:,1),time,Value(:,2)...)
You should to preallocate the size of array Value, this depends on the row and column size of your data.

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by