Error Undefined operator '*' for input arguments of type 'cell'

I am trying to multiply two numbers together and keep getting that error.
fprintf('This program will help convert units of meaure\n');
b=inputdlg('Enter your Speed');
s=menu('What are your units of measure?','Km/hr','MPH','M/S','ft/min');
switch s
case 1
x=0.2777778 * b;
case 2
x=((0.44704)*b);
case 3
x=(b);
case 4
x=((0.0050813)*b);
end

 Accepted Answer

The inputdlg function returns a cell array of strings. You need to redefine ‘b’ to a double:
b=inputdlg('Enter your Speed');
b = str2double(b{:});
The rest of your code is unchanged.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!