Input multiple Excel files into one MatLab file
Ältere Kommentare anzeigen
Hi guys,
I am a new one in MatLAB and may be my question will be a bit stupid but I need 2 or more excel files to be shown in one plot. I have them both in the same folder, all of them are working separately but when trying to open in one plot it opens only one. If anyone could help me with this would be highly appreciated! Here is what I am doing:
% Read in the data from the Excel spreadsheet
filename = '123.xls';
% Seconds is in column C
elapsedTime = xlsread(filename, 'C:C');
% Delete the first value from the time data
elapsedTime = elapsedTime - elapsedTime(1);
% Convert from seconds to hours
elapsedTime = elapsedTime/3600.0;
% Wind speed is in column E
windSpeed = xlsread(filename, 'E:E');
% Subplot the wind speed
subplot(412)
plot(elapsedTime, windSpeed);
ylabel('Wind speed (m\,s$^{-1}$)');
xlabel('Time (h)')
axis ([0 48 0 100]);
and after I am putting the second file to read:
scnd = 'Displacements.xlsx';
% Seconds is in column A
elapsedTiime = xlsread(scnd, 'A:A');
% Delete the first value from the time data
elapsedTiime = elapsedTiime - elapsedTiime(1);
% Convert from seconds to hours
elapsedTiime = elapsedTiime/3600.0;
% x displacements are in column B
deltaX = xlsread(scnd, 'B:B');
% Find the mean of the x displacements
deltaXmean = mean(deltaX);
%Subtract the mean
deltaX = deltaX - deltaXmean;
% y displacements are in column C
deltaY = xlsread(scnd, 'C:C');
..thanks
Antworten (0)
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!