gusucode.com > vnt工具箱matlab源码程序 > vnt/vnt/canMessage.m
function message = canMessage(varargin) % canMessage Construct a CAN message. % % MESSAGE = canMessage(DATABASE, NAME) constructs a MESSAGE using the NAME % to reference the message definition from the DATABASE. % % MESSAGE = canMessage(ID, EXTENDED, DATALENGTH) constructs a MESSAGE from % raw information using ID, EXTENDED, and DATALENGTH. % % Inputs: % DATABASE - A handle to a database file. % NAME - The name of the message as a string. % % ID - The message identifier. Note that ID is stored as a decimal % value. You can use the HEX2DEC function to convert a % hexadecimal ID to decimal if desired. % EXTENDED - A logical value of true if the ID is of extended % type (29-bit identifier), otherwise false if the ID is of % standard type (11-bit identifier). % DATALENGTH - The data length of the message from 0 to 8 bytes. % % Examples: % database = canDatabase('C:\Database.dbc') % message = canMessage(database, 'MessageName') % % message = canMessage(500, false, 8) % % message = canMessage(hex2dec('750'), false, 8) % % See also VNT. % % Authors: JDP % Copyright 2008-2009 The MathWorks, Inc. % Call the Message constructor. message = can.Message(varargin{:}); end