xxsimAddPlotToWindow - Add a new plot to the specified plot window Syntax: retval = xxsimAddPlotToWindow(window_ID,'plot_name') Inputs: window_ID = ID from the plot window where the plot is added to. plot_name = Name of the plot that is added to the specified window. Outputs: retval = returns a unique ID corresponding to the plot Example: retval = xxsimAddPlotToWindow(1,'Motor Torque') - a new plot with name "Motor Torque" will be added to the the window with window ID 1. - retval now contains an ID that is uniquely coupled to this newly added plot. - Note: The simulator should be open before calling this function. See also: xxsimRemovePlotFromWindow, xxsimOpenSimulator, xxsimAddPlotWindow, xxsimGetPlotsFromWindow Author: Controllab Products B.V. email: info@controllab.nl Website: http://www.controllab.nl November 2015
0001 function retval = xxsimAddPlotToWindow(window_ID,plot_name) 0002 % xxsimAddPlotToWindow - Add a new plot to the specified plot window 0003 % 0004 % Syntax: 0005 % retval = xxsimAddPlotToWindow(window_ID,'plot_name') 0006 % 0007 % Inputs: 0008 % window_ID = ID from the plot window where the plot is added to. 0009 % plot_name = Name of the plot that is added to the specified window. 0010 % 0011 % Outputs: 0012 % retval = returns a unique ID corresponding to the plot 0013 % 0014 % Example: 0015 % retval = xxsimAddPlotToWindow(1,'Motor Torque') 0016 % 0017 % - a new plot with name "Motor Torque" will be added 0018 % to the the window with window ID 1. 0019 % - retval now contains an ID that is uniquely coupled to this 0020 % newly added plot. 0021 % - Note: The simulator should be open before calling this function. 0022 % 0023 % See also: xxsimRemovePlotFromWindow, xxsimOpenSimulator, xxsimAddPlotWindow, xxsimGetPlotsFromWindow 0024 % 0025 % Author: Controllab Products B.V. 0026 % email: info@controllab.nl 0027 % Website: http://www.controllab.nl 0028 % November 2015 0029 0030 %------------- BEGIN CODE -------------- 0031 0032 % Check the obtained amount of input arguments. 0033 if(nargin>2) 0034 error('Too many input arguments were specified.'); 0035 elseif(nargin<2) 0036 error('Too little input arguments were specified.'); 0037 endif; 0038 0039 % Check if the window_ID is a number, and the plot_name a string 0040 if(!isnumeric(window_ID)) 0041 error('Please specify a number as ID for the plot window'); 0042 elseif(!ischar(plot_name)) 0043 error('Please specify a string as name for the plot'); 0044 endif; 0045 0046 % And make the actual call to 20-sim 0047 retval = xrlinvoke('xxsim.plot.addPlotToWindow', struct('windowID',int32(window_ID),'plotName',plot_name)); 0048 0049 end 0050 %------------- END OF CODE --------------