(Xlsread) Quick Question: How to compare multiple columns that are not next to each other?
1 view (last 30 days)
Show older comments
Adrian Valdivia Portilla on 16 Mar 2016
Answered: Dave Behera on 21 Mar 2016
Keep in mind I can only use basic MATLAB commands because I am just starting out in my class Is it possible to add multiple ranges to the code so it pulls columns that aren't next to each other in excel? My excel doc is very simple only being 6 columns but I want it to compare them side by side.
This is what I have so far:
cars = input('Type in the 2 cars in the format of 12, 21, 35, 51 - in any order: ');
if (cars == 12 || cars == 21)
disp('You have chosen to compare the Bentley and the Audi!');
elseif (cars == 13 || cars == 31)
disp('You have chosen to compare the Bentley and the BMW!');
[~,~,raw]=xlsread('cars.xlsx', 'A1:B8', 'D:D')
The end of it where I have 'A1:B8', 'D:D' is incorrect as it doesn't dipslay what I want it to
Dave Behera on 21 Mar 2016
To use xlsread, you must specify a rectangular area in your xls file to be read. Having columns which are not next to each other does not satisfy this criteria. Therefore, you will need to read both columns separately and combine the resulting matrices in order to get the combined data.
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!