Excel reading all columns with a loop
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
i got a question, and i really need some help cause i am pretty new to matlab.
From the excel sheet i attached i want to read each column so from Monday to Saturday and plot each Day on the y-Axis and on the X-Axis should be the time in the first column for every plot.
So i know how to read the whole excel sheet with xlsread but i dont know how ot build the loop for the reading every column separately.
Could u maybe help me with the problem?
Best Regards
0 comentarios
Respuestas (1)
Mathieu NOE
el 9 de Feb. de 2021
hello again...
based on my previous suggestion, this will do the trick :
[filename, pathname] = uigetfile('*.xlsx', 'Bitte Datei aussuchen'); % Leitungen_Auslastung.xlsx
[numericData, ~, rawData] = xlsread(fullfile(pathname, filename));
headers = rawData(1,:); % variable names
comments = rawData(2,:); % comments names / units
Y_legends= headers(2:end);
% replace underscore with blanks for legend strings
Y_legends2 = strrep(Y_legends,'_',' ');
[samples,nrows] = size(numericData);
y = numericData; % rows B and beyong (select rows with N if needed)
date_data = rawData(2:end,1);
dn=datetime(date_data,'InputFormat','yyyy.MM.dd HH.mm.ss');
figure(1),plot(dn,y);
xlabel('Time (s)')
ylabel(' Data');
legend(Y_legends2);
0 comentarios
Ver también
Categorías
Más información sobre Spreadsheets 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!