(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!