Matlab GUI displaying output based on user input

i want to create one gui with two prompt messages 1. enter semester - I marks 2. enter semester - II marks
After entering marks & pressing OK button . it has to verify one excel file (having three columns of data). When the input data matches with the A column and B column values in excel file then the output is the corresponding C Column value. Display the output of C column's value.
any one help me to write the code for this

 采纳的回答

M = xlsread('my_file.xls'); % matrix with data
x=find(M(:,1) == in_1); % in_1 is your first input
y=find(M(:,2) == in_2); % in_1 is your second input
c=find(x==y); % c returns where x==in_1 and y ==in_2
output = M(x(c),3);

3 个评论

prompt{1}='Enter Movie Rating :'; prompt{2}='Enter Revenue :'; title='Prediction'; a=xlsread('inputdata.xlsx'); ans=inputdlg(prompt,title); Category=a(ismember(a(:,1:2),*[x y]*,'rows'),3);
in the above code how can i read x and y values from the user input. iam not getting the output for this after entering values in the prompt box.. any thing is missing here?
Anyone pls give me a solution
In your case:
in_1 = str2num(ans{1});
in_2 = str2num(ans{2});
M = a;

请先登录,再进行评论。

更多回答(1 个)

类别

帮助中心File Exchange 中查找有关 Data Import from MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by