In the example code u6_simplestream.m, the data is stored in a special format:
% Init array to store data.
adblData = NET.createArray('System.Double', 2*numScans); %Max buffer size (#channels*numScansRequested)
% Read the data. The array we pass must be sized to hold enough SAMPLES,
% and the Value we pass specifies the number of SCANS to read.
numScansRequested = numScans;
% Use eGetPtr when reading arrays in 64-bit MATLAB. Also compatible with
% 32-bits.
[ljerror, numScansRequested] = ljudObj.eGetPtr(ljhandle, LJ_ioGET_STREAM_DATA, LJ_chALL_CHANNELS, numScansRequested, adblData);
The example code also shows that I can retrieve the data value by calling adblData(index) where index is a positive integer. My question is if I want to read all the data values from adblData, is there any method besides having a loop to get the value one by one? My application is time-critical so I don't want to use loop function.
Thanks for any help.
A .NET System.Double array can only use a scalar index and doesn't support the colon operator. If using a System.Double array directly you need to access elements in the array individually like you mentioned.
Alternatively, you can use double to convert adblData to a MATLAB array:
[ljerror, numScansRequested] = ljudObj.eGetPtr(ljhandle, LJ_ioGET_STREAM_DATA, LJ_chALL_CHANNELS, numScansRequested, adblData);
data = double(adblData); % Convert to MATLAB array, and use data to access samples