フィルターのクリア

Naming variables from one column Import file

5 ビュー (過去 30 日間)
meryem berrada
meryem berrada 2021 年 5 月 12 日
コメント済み: meryem berrada 2021 年 5 月 12 日
Hello,
I am importing a selected amount of cells from an excel file (selected manually - let's say cells A1:A5) and MATLAB automatically names the variable with the column name (A). Then, when I import cells A6:A10, MATLAB automatically name the variable A again, which overwrites the first variable. It is time consuming to rename the variables manually one by one as I have hundreds of them.
Is there a way to attribute imported cells to a variable name (I have a list of the variables in order) ?
Thank you!

採用された回答

Walter Roberson
Walter Roberson 2021 年 5 月 12 日
No. When you are importing variables manually using the import tool, then you are stuck with what the import tool provides.
If you already have a list of which cells to import, do the reading in code... and not assigning to individual variables.
For example the above hints that you might be grouping every 5. If so, then read the entire column at one time, and reshape() it to the number of rows each.

その他の回答 (1 件)

Rik
Rik 2021 年 5 月 12 日
Don't store data in a variable name.
You should use cell arrays or fields of a struct instead.

カテゴリ

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