How do I import an excel file using code so that I am creating a vector with each column using the column names?

1 回表示 (過去 30 日間)
When importing an excel file you can generate a function to import the file in code. This generated function however puts the data in a matrix. I need my data as column vectors. I do not wish to have to import manually every single time as I have many datasets.
If I save my file as a .txt instead of excel, and bring it in using the other wizard, it will not let me click on the 'create a vector with each column using the column names'. Its grey and not an option. I know this method has a generate code box you can click, so I do not have to do the code myself.
Does anyone know how i can import not manually?
Thanks

回答 (1 件)

Matt J
Matt J 2012 年 10 月 13 日
編集済み: Matt J 2012 年 10 月 13 日
Once you import as a matrix, you can distribute the columns to different variables by doing
Mcell=num2cell(YourMatrix,1);
[Column1,Column2,Column3,...]=deal(Mcell{:});

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by