How do i extract a column from an array

3 ビュー (過去 30 日間)
Sophia
Sophia 2024 年 5 月 15 日
編集済み: Voss 2024 年 5 月 15 日
I need to extract a cloumn from an array using Col1 = A(:,3)

回答 (1 件)

Voss
Voss 2024 年 5 月 15 日
編集済み: Voss 2024 年 5 月 15 日
This stores the 3rd column of the array A as Col1 (and displays Col1 in the command window):
Col1 = A(:,3)
Is that what you want to do?
Or by "extract", do you mean to want to store the 3rd column of A in a separate variable and also remove the 3rd column from A?
If so, you can do:
% store the 3rd column of A as Col1
Col1 = A(:,3);
% remove the 3rd column from A
A(:,3) = [];

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by