wie kann ich aus einer excel datei ein plot coden/ how can i code a plot from an excel file?
4 views (last 30 days)
Show older comments
Deutsch
hallo meinen lieben matlabern
ich versuch aus einer excel datei ein bestimmtes sheed auszuwählen um dort aus einer tabelle ein diagramm mit beschrifteter X und Y-Achse zu plotten. Dafür kann der user dann ein interface benutzen wo man die datei auswählt etc... habe bis jetzt die zwei codes geschrieben, weiß aber nicht wie ich sie verknüpfen kann bzw wa sich machen soll. merci:)
English
hello to my dear matlabers
I am trying to select a certain sheed from an excel file in order to plot a diagram with labeled X and Y axis from a table. For this the user can then use an interface where you select the file etc... have so far written the two codes, but do not know how I can link them or wa should make. merci:)
1)
may=xlsread('Häckselplatz Illingen.xlsx','Temperatur','A2:E140995');
O=may(:,1)
U=may(:,2);
Z=may(:,3);
A=may(:,4);
t=1/8766:1/8766:size(O,1)/8766;
figure(1)
plot(t,O, t,U, t,Z, t,A);
title('Häckselplatz Illingen');
xlabel('Zeit [Monaten]');
ylabel('Temperatur [°C]');
legend('Öl-Temperatur','Umgebungstemperatur','Zuluft Trafostation','Abluft Trafostation')
2)
[file,path,indx] = uigetfile('*.xlsx','Select your Excel file','C:\');
if isequal(file,0)
disp('User selected Cancel')
else
disp(['User selected ', fullfile(path, file),...
' and filter index: ', num2str(indx)])
end
filename=append(path,file);
uiimport(filename);
0 Comments
Accepted Answer
Harald
on 7 Jul 2023
Hi,
my recommendation would be:
2), in the end:
filename = fullfile(path, file);
then
may=xlsread(filename,'Temperatur','A2:E140995');
then continue with 1).
This requires that the selected file will always have a sheet 'Temperatur'. If that is not guaranteed, it might be an idea to run sheetnames and then show a dialog to let the user select the sheet, similarly for the range.
Best wishes,
Harald
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!