(Xlsread) Quick Question: How to compare multiple columns that are not next to each other?
1 次查看(过去 30 天)
显示 更早的评论
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!');
[~,~,raw]=xlsread('cars.xlsx','A1:C8');
disp(raw)
elseif (cars == 13 || cars == 31)
disp('You have chosen to compare the Bentley and the BMW!');
[~,~,raw]=xlsread('cars.xlsx', 'A1:B8', 'D:D')
disp(raw)
The end of it where I have 'A1:B8', 'D:D' is incorrect as it doesn't dipslay what I want it to
Help?
0 个评论
回答(1 个)
Dave Behera
2016-3-21
Hi Adrian,
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.
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!