How can I load data from Excel file to Matlab in script and use the data loaded to calculate?

1 vue (au cours des 30 derniers jours)
Hi guys, I am a newbie in Matlab and I am using Matlab for my thesis. I have an excel file contain data and I want to load these data into Matlab and therefore I can write programme to calculate using these data in Matlab. How can I do that? Can you show me the full code because I am so new to this. Thank you very much!

Réponses (2)

David Hill
David Hill le 28 Fév 2023
Use readmatrix or readtable. If you attach your spreadsheet we could help more.
  2 commentaires
Newbie
Newbie le 28 Fév 2023
My code
clc
syms t s Gs Gt Ks Es Et
E0 = [10490.3622];
v = 0.3;
Et = simplify(laplace(Et, t, s));
Ks = E0/(3*s*(1-2*v));
Gs = (9*Ks-Es)/(Es*Ks);
Gt = ilaplace(Gs,t);
writematrix([value_t(:),Gt(:)],'C:\Relaxation modulus\data.xlsx');

Connectez-vous pour commenter.


David Hill
David Hill le 28 Fév 2023
MSU1=readmatrix('Relaxation data.xlsx','Range','A4:E82')%load the others following the same method
MSU1 = 79×5
1.0e+04 * 0 0 0 NaN 0 0.0000 0 0.0001 NaN NaN 0.0003 0.0000 0.0005 0.4870 0.1873 0.0005 0.0000 0.0008 0.8009 0.3080 0.0007 0.0000 0.0013 1.1517 0.4430 0.0009 0.0000 0.0016 0.6929 0.2665 0.0011 0.0000 0.0019 0.8668 0.3334 0.0013 0.0000 0.0023 1.0303 0.3963 0.0014 0.0000 0.0026 0.5757 0.2214 0.0016 0.0000 0.0029 0.8582 0.3301
  3 commentaires
David Hill
David Hill le 28 Fév 2023
use readtable instead and assign variable names.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by