How to read the specific colums from 12 excel files in a folder and then plot it
Show older comments
Hi,
I want to read column 4 and 10 from each excel file in the folder and then plot column 4 and 10 of each file in one graph. So far I tried the code below but it is only plotting one graph. Any help would be appreciated.
Code:
folder = fullfile('C:','Users','muhammad','Documents','PhD_1stYr','Experiments_2021','performance_110');
files = dir( fullfile(folder, '*.ods') );
% Reading and extracting data from 12 excel files hence plotting
for ii = 1:length(12)
data = readmatrix(fullfile(files(ii).folder,files(ii).name), 'NumHeaderLines', 1)
x= data(:,10)
y=data(:,4)
figure(1)
% Plotting data
plot(x,y,'x','LineWidth',0.5);
hold on
%Spacing and griding
xlim([0.237 5])
ylim([0.237 0.8])
hold on
grid on
end
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!