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 visualización (últimos 30 días)
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') );

Respuesta aceptada

Shivang Srivastava
Shivang Srivastava el 23 de Abr. de 2021
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.

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by