How to convert excel column data into an array in MATLAB

I have experimental data, I need to plot the data into arrays in matab code. In the data there is data points for Time, Load, and Displacement. I need to make three arrays to represent data point. I have attached the excell sheet Any help will be great thank you!!!

 採用された回答

Voss
Voss 2022 年 3 月 24 日

0 投票

It's really very fine and good to keep all your data in a matrix (called data, say), in this case with three columns, so that when you need Time you say data(:,1), when you need Load you say data(:,2), etc., but if you want three separate variables, you can do that too:
data = readmatrix('Test1.csv')
data = 93008×3
0 -2.3603 -0.0000 0.0030 2.9350 -0.0006 0.0070 -2.1086 0.0000 0.0080 -0.9127 -0.0003 0.0180 0.3109 -0.0038 0.0290 -2.3772 -0.0083 0.0400 -5.0812 -0.0153 0.0500 -4.6448 -0.0198 0.0610 -9.2654 -0.0251 0.0710 -8.7627 -0.0307
Time = data(:,1);
Load = data(:,2);
Displacement = data(:,3);
% plot Load and Displacement vs Time:
% plot(Time,[Load Displacement]) % same as below
plot(data(:,1),data(:,[2 3]));
legend('Load','Displacement');
xlabel('Time');

2 件のコメント

Ravi N
Ravi N 2022 年 3 月 24 日
Thank you!!!!!
Voss
Voss 2022 年 3 月 24 日
You're welcome!
If you have any questions, please let me know. If not, and if this answer works for you, please mark it as 'Accepted'. Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Import from MATLAB についてさらに検索

製品

リリース

R2020b

質問済み:

2022 年 3 月 24 日

コメント済み:

2022 年 3 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by