www.gusucode.com > simulinkcoder 案例源码程序 matlab代码 > simulinkcoder/GnrtCAPIDataDefFileForExchngngDataWithTargSysExample.m

    %% Generate C API Data Definition File for Exchanging Data with a Target System
% This model illustrates the target-based C API for interfacing signals, parameters, and states in the generated code.  
%% Open Example Model
% Open the example model |rtwdemo_capi|.
open_system('rtwdemo_capi');
%%
% The C API is useful for real-time interaction with application data, without having to stop execution or recompile
% the generated code.  Typically, a client/server protocol is set up from a host to a target using serial, TCP/IP, or
% dual-port memory connection.  The purpose of this example is not the client/server protocol.  Rather, 
% this model shows the necessary data interface required by the C client/server programs.
% 
% You enable the C API by selecting one or more C API options on the *Code Generation > Interface* pane of the
% Configuration Parameters dialog box.  Any signal or parameter or state with an addressable storage class
% is placed in the C API data structure in |_model__capi.c|. Note that signals, states, and parameters in the
% referenced model can be accessed using C API. So make sure that C API is enabled for the referenced model.