필터 지우기
필터 지우기

How to read and select data from Excel

조회 수: 4 (최근 30일)
Ali Deniz
Ali Deniz 2022년 3월 27일
댓글: Ali Deniz 2022년 3월 28일
I have an excel data in the following. How can I select the data from this excel table. For example; how can I select the Cl and Cd values while alpha changes?

채택된 답변

Mahmoud Ashraf
Mahmoud Ashraf 2022년 3월 27일
t=readtable('Excel file name','Range','size');
  댓글 수: 3
Siddharth Bhutiya
Siddharth Bhutiya 2022년 3월 28일
You could read the excel file into a MATLAB table as mentioned above using readtable. Once you have the table, you can use subscripting based on your desired condition to select the appropriate values.
>> t
t =
11×3 table
alpha Ci Cd
_____ _______ ________
0 0.48812 0.44681
0.5 0.97057 0.012023
1 0.56811 0.034271
1.5 0.27397 0.39877
2 0.12908 0.97945
2.5 0.15519 0.54277
3 0.26881 0.91239
3.5 0.43389 0.32416
4 0.3959 0.29052
4.5 0.42525 0.87897
5 0.61439 0.77914
>> t(t.alpha == 3,:) % Select rows where alpha is 3
ans =
1×3 table
alpha Ci Cd
_____ _______ _______
3 0.26881 0.91239
>> t(t.alpha > 2.5,:) % Select rows where alpha is greater than 2.5
ans =
5×3 table
alpha Ci Cd
_____ _______ _______
3 0.26881 0.91239
3.5 0.43389 0.32416
4 0.3959 0.29052
4.5 0.42525 0.87897
5 0.61439 0.77914
Ali Deniz
Ali Deniz 2022년 3월 28일
Thank you so much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by