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!