Write a program which has differnt cases

I'm writing a program that should allow a user to pick from a list of 20 different mathematical cases. Once the case has been selected they are allowed to input 6 different variables. After that the program should use the numbers and the case selected and do the computation. How do I start on this? and are there any examples like this?

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 6 月 22 日

0 投票

Hint:
case_names = cellstr( num2str((1:20).', 'case #%d') );
choice = menu('Pick one', case_names{:});
switch choice
case 1: ....
otherwise: ....
end

1 件のコメント

ROJI
ROJI 2016 年 6 月 22 日
I appreciate it man. Is there anyway to let the user input the 6 values in that GUI itself after the user picks a case?
This is what I'm using now
case_names = cellstr( num2str((1:20).', 'case #%d') );
choice = menu('Pick one', case_names{:});
switch choice
case 1
r1=input('Value =');
r2=input('Value =');
re1=input('Value =');
re2=input('Value =');
rf1=input('Value =');
rf2=input('Value =');
disp(addition of everything)
otherwise
end
The problem is it exits from the pick window and goes into matlab

この質問は閉じられています。

製品

質問済み:

2016 年 6 月 22 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by