www.gusucode.com > robotsimulink 工具箱 matlab源码程序 > robotsimulink/robotslros/+robotics/+codertarget/+internal/Util.m
classdef Util %This class is for internal use only. It may be removed in the future. %codertarget.Util - Utility functions related to generating ROS node % using Coder Target infrastructure % Copyright 2014 The MathWorks, Inc. methods(Static) function pkgName = modelNameToValidPackageName(modelName) validateattributes(modelName, {'char'}, {'nonempty'}); % ROS package names should start with a lower case letter and % only contain lower case letters, digits and underscores. % Model names have to be valid MATLAB identifiers (i.e., start % with an alphabet character, only underscores & alphanumeric). assert(isvarname(modelName)); pkgName = regexprep(lower(modelName), '\W', ''); if isempty(pkgName) error(message('robotics:robotslros:cgen:UnableToCreateROSPkgName', modelName)); end end function isValid = isValidPackageVersion(versionStr) validateattributes(versionStr, {'char'}, {}); isValid = strcmpi(versionStr, regexp(versionStr, '^\d+\.\d+\.\d+$', 'match', 'once')); end end end