selecting columns by their name
7 ビュー (過去 30 日間)
古いコメントを表示
Hi, I use the attached test.xlsx file as an example to explain my problem. Assume that I have the test.xlsx in excel and I want to use this to do operations on its columns. But this operation just needs to be performed on specific columns. For example I need my code to first select the numerical values in columns that have "AUD AUD_EOD" with "Zero 1d" and "AUD AUD_EOD" with "Zero9m" in their titles to be saved in a matrix A. Then do the same thing for columns with "CAD CAD_EOD" with "Zero 1d" and "CAD CAD_EOD" with "Zero9m" in their titles and save them in matrix B and then do the operation on matrix A and B. So my problems is that, how can I do this selection without using for loops. Again as I said the test.xlxs is just a sample and I basically have a huge file that this needs to be done for it.
I appreciate any comments to solve this problem.
Thanks,
0 件のコメント
回答 (1 件)
Image Analyst
2016 年 4 月 30 日
編集済み: Image Analyst
2016 年 4 月 30 日
It's easy if you use tables. Use readtable() to read in the workbook
t = readtable('test.xlsx', 'Range', 'B4:L9')
oneColumn = t.AUDAUD_EOD % Get just this one column with this name
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!