Skip to content
Snippets Groups Projects
Commit 5ccba86c authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Fix minor bugs in mode/type test functions

parent e460f3e4
Branches
Tags
No related merge requests found
......@@ -10,15 +10,13 @@ function mode = DeviceMode(type, modeNo)
% Motors are a special case where the mode name does not equal the type name
if type == DeviceType.LargeMotor || type == DeviceType.MediumMotor
mode = DeviceMode.Motor(modeNo);
elseif type == DeviceType.Unknown || type == DeviceType.None || type == DeviceType.Error
mode = DeviceMode.Default.Undefined;
else
mode = DeviceMode.(char(type))(modeNo);
end
catch ME
if strcmp(ME.identifier,'MATLAB:undefinedVarOrClass')
mode = DeviceMode.Default.Undefined; % Need to think about this...
else
error('ModeNo ''%d'' not valid for given type.', modeNo);
end
error('ModeNo ''%d'' not valid for given type.', modeNo);
end
end
function isValid = isModeValid(mode, type)
% Returns whether given mode is a valid mode in given type.
if strcmp(class(mode), 'DeviceMode.Default')
isValid = true;
return;
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment