matLAB Gui Query Excel

filename = 'HE_Data.xlsx';
sheet = 1;
xlRange = 'H10:AB10';
num = xlsread(filename,sheet,xlRange,'basic');
fname = {'Agriculture and related subjects','Architecture Building and Planning','Biological Sciences','Business and Administrative studies','Computer Science','Creative Arts and Design','Education','Engineering and Technology','Geographical Studies','Historical and Philosophical studies','Initial Teacher Training','Languages','Law','Mass Communications and Documentation','Mathematical Sciences','Medicine and Dentistry','Social Studies','Physical Sciences','Subjects allied to Medicine','Veterinary Sciences','Combined'};
x = 1:21; y = (num);
bar(x,y)
set(gca, 'XTick', 1:length(fname),'XTickLabel',fname);
xtickangle(90)
title('Aston University - Entrants in Each Field of Study')

6 件のコメント

Image Analyst
Image Analyst 2018 年 11 月 29 日
John Smith
John Smith 2018 年 11 月 29 日
編集済み: Guillaume 2018 年 11 月 29 日
wow thanks here it is:this is the error im recieving. I tried the code from https://uk.mathworks.com/help/matlab/ref/xlsread.html
Geoff Hayes
Geoff Hayes 2018 年 11 月 29 日
John - what is the error that you are receiving? Or is it the error that your bar graph looks like the above? What should it look like? What can you tell us about the
num = xlsread(filename,sheet,xlRange,'basic');
data?
John Smith
John Smith 2018 年 11 月 29 日
編集済み: John Smith 2018 年 11 月 29 日
well the data should be similar to this for example:
y = [0,60,60,30,100,60,0,120,0,0,0,0,0,0,0,0,10,0,0,0,0];
thats inputed manually. I want to read those digits from the excel file which i tried doing but
it just shows the y axis starting from 0 to 1 instead of what it should be.
xlRange = 'H10:AB10'; is the cell range with those numbers in each cell.
Geoff Hayes
Geoff Hayes 2018 年 11 月 29 日
so it should be similar to the above data, but what are you really reading in?
John Smith
John Smith 2018 年 11 月 30 日
編集済み: John Smith 2018 年 11 月 30 日
these numbers from cell H10 to Ab10. some are blank aka 0. ive attached document have a look (HE_Data.xlsx)

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeText Data Preparation についてさらに検索

質問済み:

2018 年 11 月 29 日

編集済み:

2018 年 11 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by