how to read 4th and 10th column of 12 excel files from folder and then plot 4th and 10th column of each excel file
1 次查看(过去 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') );
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!