I want to read multiple non-adjacent columns from an excel spreadsheet

2 views (last 30 days)
Hi there,
I would like to read in four non-adjacent columns from an excel spreadsheet, how do I do this? Example shows I want parts of columns C,H,M and R...
"X = xlsread('mydata.xlsx','C3:C127,H3:H127,M3:M127,R3:R127') ;"
Thanks a lot!

Answers (1)

Rik
Rik on 9 Mar 2017
I would read the entire file and select the data in Matlab afterwards. You need the Excel syntax in the string. I don't think it is possible in the way you want to do this.
X = xlsread('mydata.xlsx');
X=X(3:127,'CHMR'-64);%this trick relies on the conversion from ASCII to an index value

Community Treasure Hunt

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

Start Hunting!