How can I extract column names from xls sheet and make them workspace variables?

2 ビュー (過去 30 日間)
Rosemaryl21
Rosemaryl21 2020 年 7 月 28 日
コメント済み: Stefan Mwale 2021 年 9 月 9 日
Hi, I have imported an excel spreadsheet to Matlab titled "Mockdata". There are two columns within this spreadsheet, "Time" and "Depth". The table called "Mockdata" is the only variable in my workspace; Time and Depth are not currently variables. I can plot the table by saying plot(Mockdata.Time, Mockdata.Depth), but how do I save Time and Depth as their own variables in the workspace, so I can simply plot (Time, Depth)? Thanks.

採用された回答

KSSV
KSSV 2020 年 7 月 28 日
Time = Mockdata.Time ;
Depth = Mockdata.Depth ;
  2 件のコメント
Rosemaryl21
Rosemaryl21 2020 年 7 月 29 日
Thank you very much
Stefan Mwale
Stefan Mwale 2021 年 9 月 9 日
You can simply double click the value of your file(at the Workspace)and when it opens, highlight all the contents of the table, then follow these steps... New Workspace Variable from Selection >> Separate Workspace variables. All the Column names of your .xls or .xlsx file will automatically be made into individual variable names and displayed on the Workspace.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by