Assigning Columns to Multiple Variables

Lets say I have a table of 5 columns in my workspace.
I want each of the variables A, B, C, D to be assinged to a single column.
For exaple A = Column 1, B=Column 3 etc.
I know I can write A = Table( : ,1), but is there a way to do it all at once instead of individually?

 採用された回答

Matt J
Matt J 2021 年 4 月 5 日
編集済み: Matt J 2021 年 4 月 5 日

1 投票

for i=1:4, Q{i}=Table{:,i}; end
[A,B,C,D]=deal(Q{:})

1 件のコメント

John Antwniou
John Antwniou 2021 年 4 月 5 日
Thank you, much appreciated!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWorkspace Variables and MAT Files についてさらに検索

製品

リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by