Page tree

How to read and write DOOCS properties with Matlab


Quick Start

The manual of the DOOCS Matlab client interface can be found on the DOOCS web pages. Examples showing how to read train ID synchronous values using doocsread are maintained on Bitbucket.

If you can not use Python, we recommend to use the Mex function doocsread with Matlab as installed on our workstations. It works with Matlab R2016b and is installed on flashlxuser1, flashlxuser2, and the GNU/Linux workstations in the FLASH halls (hasfcons0 to hasfcons10 and hasfpg0, hasfpg3).

Please do not use doocs_read or ttfr et al..



To read sample spectra from the SP Devices ADQ412 ADCs there are two servers which could be accessed. The server SPDEVDMA should only be used for debugging purposes. Don't touch it during data acquisition for an experiment with beamtime. The ADQ scope servers (ADC.ADQ.FL2EXP1, ADC.ADQ.BL1 to ADC.ADQ.BL3, ADC.ADQ.PG, ADC.ADQ) are recommended to use for live data access.

Note: To access the ADQ scope servers you might have to set properties, which also affect the recording of samples to the DAQ and the data access of other users. So be careful changing any properties' values.

Currently the number of samples accessible this way is limited to 1,048,575 samples. The code snippet below shows how to read the current spectrum with the maximum number of samples.

%% ADQ Scope Server MTCA FL2-EXP1
% Note CH00.INCR_LOGIC does not do anything
%      CH00.RAW_COPY must be '1' in order to receive more than 800 values
location= 'FLASH.FEL/ADC.ADQ.FL2EXP1/FL2EXP1.CH01/'; 
errorMsg= doocswrite([location, 'CH00.RAW_COPY'], 1);
assert(isempty(errorMsg), 'doocsread error: %s', errorMsg);
% read
mtcaSpectrumNestedStruct= doocsread([location, 'CH00.RAW_COPY']);
assert(isempty(mtcaSpectrumNestedStruct.('error')), ...
        'Error: doocsread: ''%s''', mtcaSpectrumNestedStruct.('error'));
% unwrap
mtcaSpectrumStruct= mtcaSpectrumNestedStruct.('data');
mtcaSpectrum= mtcaSpectrumStruct.('d_spect_array_val');
% create time axis and plot
start= mtcaSpectrumStruct.('s_start');
increment= mtcaSpectrumStruct.('s_inc');
sLength= mtcaSpectrumStruct.('d_spect_array_len');
assert(sLength == length(mtcaSpectrum));
spectrumTimeAxis= start : increment : start + increment*(sLength - 1);
plot(spectrumTimeAxis, mtcaSpectrum);


Example Matlab scripts


jdoocs_call (deprecated, unmaintained)

We strongly suggest not to use the M-function `jdoocs_call`. It has been deprecated since 2014 and has not been maintained since then. The files below are kept for reference only. In many cases they won't work any longer.

In the attachment a collection of old files can be found:

  • in the jDOOCS zip:
    • the *.jar files for the Java DOOCS implementation and its dependencies
    • the jdoocs_call.m function which eases the jDOOCS handling and can be used to read numbers and Vectors (spectra ... 1D data)
    • a sample program to read 0D (numbers) and 1D (spectra) data with jdoocs_call (jDOOCS_read_sample_0D_and_1D.m)
    • a sample program to read 2D (images) (jDOOCS_read_sample_2D.m)


  • No labels