only reading and plotting data for one file while I want it to read and plot data for 12 files
Afficher commentaires plus anciens
Hi,
I am trying to read column 4 and 10 from 12 excel files and plot 12 graphs from it but I am only getting plot 1. Below is the code can you guide me how to do it properly.
Code:
close all; clear all; clc;
% To access the folder
folder = fullfile('C:','Users','muhammad','Documents','PhD_3rdYr','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 6])
ylim([0 0.8])
hold on
grid on
% Outlet starting
y = 0.237;
line ([0,5],[y,y],'color','r');
txt = {'Outlet,Invert Level = 237 mm'};
text(1,0.25,txt)
% Design Head
y = 0.737; %17 mm
line ([0,5],[y,y],'color','r');
txt = {'Design Head = 737 mm'};
text(1,0.76,txt)
% Design Limit Box
x =5;
line ([x,x],[0,0.737],'color','r')
hold on
%Chart Representation
title('Outlet-110 mm');
xlabel('flowrate (l/s)');
ylabel('Head (m))');
% legend('VFC');
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!