how to read 4th and 10th column of 12 excel files from folder and then plot 4th and 10th column of each excel file

2 次查看(过去 30 天)
Hi,
How can I read the specific columns and from the bunch of excel files and then use the column data to plot the sub-plot of graphs?
Sofar,
close all; clear all; clc;
folder = fullfile('C:','Users','muhammad','Documents','PhD_3rdYr','Experiments_2021','performance_110');
files = dir( fullfile(folder, '*.ods') );

采纳的回答

Shivang Srivastava
Shivang Srivastava 2021-4-23
As per my understanding you want to read all files in a directory and read the excel files and plot the values in particular columns.
currentpath = pwd;
dataPath = string(currentpath)+ '\data';
allFiles = dir(dataPath);
sz = size(allFiles,1);
figure
for i = [3:sz]
% The index start from 3 because for i = 1 & 2,
% allFiles.names is '.' & '..' respectively.
path = dataPath + '\' + allFiles(i).name;
data = readtable(path);
hold on
plot(data.Var4)
hold on
plot(data.Var10)
end
Here, Var4 and Var10 are used for column 4 & 10. You can use Var<n> where n is the column number.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by