How to read two Excel files and assign columns as variables in MATLAB?

21 vues (au cours des 30 derniers jours)
FW
FW le 4 Avr 2019
Modifié(e) : FW le 5 Avr 2019
Hello, I am using MATLAB 2017b. I have two Excel.xlsx files, call them A and B, containing time vs. instrument signals under two different conditions. I would like treat the columns of A and B as variables for performing further operations such division in the Fourier domain. The first column in A.xlsx is "t" and second column "S", and the first column in B.xlsx as X and second one as S0. I checked from the web and youtube videos to use xlsread, how do you assign a variable name to a particle column in MATLAB. Thanks.

Réponse acceptée

Walter Roberson
Walter Roberson le 5 Avr 2019
num = xlsread('A.xlsx');
t = num(:,1);
S = num(:,2);
num = xlsread('B.xlsx');
X = num(:,1);
t0_and_S0 = num(:,2);
or
A = readtable('A.xlsx');
B = readtable('B.xlsx');
t = A.t;
S = A.S;
X = B.X;
t0_and_S0 = B{:,2}; %I do not want to guess the variable name it ended up with

Plus de réponses (0)

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by