function [result,cr_items,r_stats] = mes_yourcheckid(system,cmd_s) %#ok % Check: % % function [result,cr_items,r_stats] = (system, cmd_s) % % INPUT PARAMETERS: % ================= % system: spefies the model/system/block to be searched by the check % format: full path name or handle or a list of full path names or handles % (arrays and 2d arrays are not supported) % cmd_s: command string to specify nonstandard calling options % may contain any number of key/value pairs according to following % syntax: '/:(!)(!) (/:(!)(!)) (...)' % : command option key word (see below) % : value of the associated key % if contains whitespaces, slashes or other keywords, % it must be enclosed in exclamation marks, % e.g. '/ignorelist:!c:\Program Files\register.igl!' % val can also be empty if the key simply sets a flag, % whereas the colon must be present , e.g. '/register:' % % supported key words % % key val meaning/example % % /register :(empty) if set, performs a register-call, % i.e. only returns check infos, but does % not perform the check % /ignorelist :!! list containing blocks/subsystem % that are ignored by the check % e.g. /ignorelist:!c:\myignorelist.igl! % /fixmode :user shows a dialog where the user can % decide, if and how the found % deviations are fixed. % :automatic fixes automatically all found rule % deviations, given the check supports % a fix action % :interactive shows a dialog which enables the % user to view the found rule % deviations (items) one by one and % decide for each item if a fix should % be made or not. % /followlinks :on find_system option: do follow library links % :off find_system option: do not follow library links % /lookundermasks :none find_system option : dont look under masks % :graphical : Masks with no workspace and no dialog % :functional : Masks with no dialog % :all % /quiet :(empty) if set, most messages on the MATLAB % Command Window are suppressed. % /xml % % note: all /fixmode options assume that the check support fixing. % note: shortcuts of keys (but not of vals) are recognized if unique % within the active keylist (as defined in mxam_cmdkeylist) % e.g.: '/f:user' % % RETURN PARAMETERS: % ================== % result: string with a short description of the check result % 'failed' | 'passed' | 'fixed' | 'Error ' | 'fixed/failed' % cr_items: cell array with structs on the found rule deviation % fields common to all item: % .qualifier: describes item type ('block','tl-block','signal','sf-chart') % .result: 'faulty', 'fixed' 'fix failed' % .linkaction: hyperref string linking to the faulty/fixed items % r_stats: struct with statistics on the check result % checkeditems.count % ignoreditems.count % fixeditems.count % % CHECK: % ====== % % % % % PASS CRITERIA: % ================ % % FAIL CRITERIA: % ================ % % FIX ACTION: % =========== % % *********************************************************** % Copyright: % Date: % Version: % *********************************************************** % % See also mxam_cmdkeyset, mxam_add2cmdstr % Template for a standard mes check, save as mes_checks/user/mes_.m % getting checkinfo from Database (assumes that check is registered in the DB) [reg,s_regerr] = mxam_getCheckInfoFromDB('yourcheckid'); %#ok % <-- ENTER YOUR CHECK-ID HERE ! % add custom information to the check info structure: % reg.fixable='yes'; % include only if your check supports a fix action reg.version_id = '1.1'; % some version info, reserved to be included in the check report reg.filename = mfilename; % add the actual filenmae to the check info structure % include this line if your check uses a TargetLink method (tl_find, % check_param with tl-option set) % reg.tl_required='yes'; % ------------------------------------------------------------ % STEP 2: Validate input arguments and initialize variables mes_preprocess; % sets done=1 when immediate return is required if done == 1 % ,mes_preprocess detected reason for not executing the check? return % then return here end try % ------------------------------------------------------------ % STEP 3: YOUR CUSTOM CODE PART STARTS HERE... % find the blocks the check should investigate: blocks = find_system(model_name, ... 'LookUnderMasks', lookundermasks,... 'FollowLinks',followlinks,... 'BlockType', 'Inport'); % <----- SET YOUR SEARCH CRITERIA HERE !!! % ------------------------------------------------------------ % STEP 4 : Initialize Progress Bar % init progress bar (for GUI), needs to be done before calling mes_periprocess % (set argument 2 (imax) to 0, if the number of items is not known yet) mes_progress('please wait...',length(blocks),mesvar_PBStep,reg.check_id,0); % (progressbar will be updated in mes_periprocess and check_param) % ------------------------------------------------------------ % STEP 5 : Apply ignorelist and update statistics: [blocks,r_stats] = mes_periprocess(blocks,r_peri_ops); % ------------------------------------------------------------ % STEP 6 : Check and optionally fix parameters % set custom check_param options: % (dont change name of r_cp_ops) r_cp_ops.s_qualifier = 'block'; % needed to determine link actions [fixlog,cr_items] = check_param(blocks,'ForeGroundColor','blue','Foreground color',r_cp_ops); % Check your parameter here: % ------------------------------------------------------------ % STEP 7 : Complete statistics and clean-up mes_postprocess; catch % IF AN ERROR OCCURS DURING CHECK EXECUTION REPORT THIS IN THE CATCH % BRANCH le = lasterror; result = ['Error in ' reg.filename ': ', mes_shortErrorLocationString(le,true)]; % return error message mes_postprocess; % but do postprocessing before returning return end