No BSD License  

image thumbnail

NEWXPC

by

 

28 Nov 2004 (Updated )

newxpc does create a new model with all specific xPC Target needed settings for Code Generation.

newxpc.m
function newxpc(mdlName)
% NEWXPC generate a skeleton Simulink Model with specific xPC settings
% 
%   NEWXPC generate a new Simulink Model with needed specific xPC Target
%   settings for beeing able to generate Code for Supported xPC Targets.
%   Use as Basis the Empty >> xpcemptymdl Template Model which is
%   supplied by xPC Target Software installation. These should help in an
%   easier way to create quick xPC Target based Simulink Models instead of
%   made everytime all xPC specific settings in the new Model.
%
%   NEWFCN, NEWSL, NEWXPC and NEWFCN_RENAME are a set of M-Functions which
%   shold help the MATLAB user to create Functions, Simulink and xPC Target
%   based Models in a quick way.
% 
%   These Files are shared for all Users in :
%   http://www.mathworks.com/matlabcentral/fileexchange
%
%   Syntax: >> newxpc('xPCNewModel')  or  >> newxpc xPCNewModel
%
%   See also: NEWSL NEWFCN NEWFCN_RENAME

%% AUTHOR    : Frank Gonzlez-Morphy 
%% $DATE     : 17-Mar-2003 15:35:31 $ 
%% $Revision : 1.00 $ 
%% DEVELOPED : R13.0 
%% FILENAME  : newxpc.m 

if nargin == 0      % does user provide Model Name ?
    help(mfilename)
    return
end
if ischar(mdlName) == 0  % Is Model Name a valid String ?
    error('  MSG: You must define a Model Name, like ''MyModel'' !')
end
if exist(mdlName) == 4   % 4 = MDL-Name in ML Path
    error('  NEWSL: Entered Modelname already exist!')
end

open_system('xpcemptymdl')            % Open Model with xPC Target Settings
save_system('xpcemptymdl', mdlName)   % Save skeleton Model under enterd Name
% ========  Some user specific Informations  ==============
% .. reset his Position and size ...
set_param(mdlName', 'Location', [638 213 1350 524])
% -----------------------------------
author = 'Frank Gonzalez-Morphy';
desc_1st_line_0x = version;   % standard versioning output of MATLAB
desc_1st_line_01 = 'Created under: ';
desc_1st_line = [desc_1st_line_01, desc_1st_line_0x];
% -----------------------------------
ml = ver('matlab');                   % actual MATLAB Version 
ml_ver_info = ['ML-Version: ', ml.Version, ' / Release Name: ', ml.Release ];
desc_2nd_line = ml_ver_info;
% -----------------------------------
sl = ver('simulink');                 % actual Simulink Version
sl_ver_info = ['SL-Version: ', sl.Version, ' / Release Name: ', sl.Release ];
desc_3rd_line = sl_ver_info;
% -----------------------------------
xpc = ver('xpc');                     % actual Simulink Version
xpc_ver_info = ['xPC-Version: ', xpc.Version, ' / Release Name: ', xpc.Release ];
desc_4rd_line = xpc_ver_info;
% -----------------------------------
desc_5th_line_0x = datestr(now);      % Actual Time
desc_5th_line_01 = '$ Date: ';
desc_5th_line = [desc_5th_line_01, desc_5th_line_0x, ' $' ];
% -----------------------------------
set_param(mdlName, 'Creator', author)
desc = {desc_1st_line; ,...
        desc_2nd_line; ,...
        desc_3rd_line; ,...
        desc_4rd_line; ,...
        desc_5th_line};
set_param(mdlName, 'Description', char(desc))
% =========================================================
sl = ver('simulink'); 
slver = str2num(sl.Version);
if slver(1,1) == 6
    cs = get(getActiveConfigSet(mdlName));
    set(cs.Components(7), 'RTWVerbose', 'off') % (7) = Simulink.RTWCC
end
% =========================================================

simulink    % Open the Simulink Library

% ===== EOF ====== [newxpc.m] =====  

Contact us