How can I import excel file (.xlsx) in Matlab and store the 4th column in a vector?

8 ビュー (過去 30 日間)
M
M 2022 年 6 月 30 日
回答済み: Image Analyst 2022 年 7 月 1 日
How can I import an excel file which contains 4 columns (.xlsx) in Matlab and store the 4th column in a vector?

回答 (2 件)

Cris LaPierre
Cris LaPierre 2022 年 7 月 1 日
Use readtable with the following syntax to read the data into a table:
To just read the 4th column, use 'Range','D:D' for the Name and Value inputs.
If your data is just numbers, you may consider using readmatrix as well, which returns an array.
You can use the name-value input to read in a specific column.

Image Analyst
Image Analyst 2022 年 7 月 1 日
data = readmatrix(fileName); % Read entire workbook into 2-D matrix.
column4 = data(:, 4); % Extract column 4 only into column vector.

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by