Return vector of signal values


int xPCGetSignals(int port, int numSignals, const int *signals, 
double *values);


Do not use this C API type definition. Support for this type definition relies on support for the C API, which will be removed in a future release.



Enter the value returned by the function xPCOpenTcpIpPort.


Enter the number of signals to be acquired (that is, the number of values in signals).


Enter the list of signal numbers to be acquired.


Returned values are stored in the double array values.


If the function completes execution without detecting an error, it returns 0. If the function detects an error, it returns -1.


The xPCGetSignals function is the vector version of the function xPCGetSignal. This function returns the values of a vector of signals (up to 1000) as fast as it can acquire them. The function acquires some signal values in one time step and later signals in another. To acquire signal values within one time step, define a scope of type SCTYPE_HOST and use xPCScGetData. xPCGetSignal does the same thing for a single signal, and could be used multiple times to achieve the same result. However, the xPCGetSignals function is faster, and the signal values are more likely to be spaced closely together. The signals are converted to doubles regardless of the actual data type of the signal.

For signals, store the list you provide in an integer array. Get the signal numbers with the function xPCGetSignalIdx.


To reference signal vector data rather than scalar values, pass a vector of indices for the signal data. For example:

/* Assume a signal of width 10, with the blockpath 
* mySubsys/mySignal and the signal index s1. 
int i; 
int sigId[10]; 
double sigVal[10]; /* Signal values are stored here */ 
/* Get the ID of the first signal */ 
sigId[0] = xPCGetSignalIdx(port, "mySubsys/mySignal/s1"); 
if (sigId[0] == -1) { 
/* Handle error */ 
for (i = 1; i < 10; i++) { 
     sigId[i] = sigId[0] + i; 
xPCGetSignals(port, 10, sigId, sigVal); 
/* If no error, sigVal should have the signal values */ 

To get the signals repeatedly, repeat the call to xPCGetSignals. If you do not change sigID, call xPCGetSignalIdx only once.

Introduced before R2006a