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') );

채택된 답변

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