Need help for Instrument Control Toolbox with PicoScope 5000a

1 回表示 (過去 30 日間)
hsnal
hsnal 2024 年 1 月 12 日
回答済み: UDAYA PEDDIRAJU 2024 年 1 月 24 日
I am acquring data in Matlab using Picoscope and Matlab instrument driver master for PicsoScope 5243D. I want all the data to be acquired in floating point rather then being in integer format. I have tried several attempt and now require help with this that How can i acquire a raw data in floating point using Instrument control Toolbox for PicoScope?
The code for Data buffer, which include driver buffer and application buffer:
%% Set data buffers
% Data buffers for channels A and B - buffers should be set with the driver,
% and these *MUST* be passed with application buffers to the wrapper driver.
% This will ensure that data is correctly copied from the driver buffers
% for later processing.
overviewBufferSize = 100000; % Size of the buffer to collect data from buffer.
segmentIndex = 0;
ratioMode = ps5000aEnuminfo.enPS5000ARatioMode.PS5000A_RATIO_MODE_NONE;
% Buffers to be passed to the driver
pDriverBufferChA = libpointer('int16Ptr', zeros(overviewBufferSize, 1, 'int16'));
status.setDataBufferChA = invoke(ps5000aDeviceObj, 'ps5000aSetDataBuffer', ...
channelA, pDriverBufferChA, overviewBufferSize, segmentIndex, ratioMode);
% Application Buffers - these are for copying from the driver into.
pAppBufferChA = libpointer('int16Ptr', zeros(overviewBufferSize, 1, 'int16'));
% Streaming properties and functions are located in the Instrument Driver's
% Streaming group.
streamingGroupObj = get(ps5000aDeviceObj, 'Streaming');
streamingGroupObj = streamingGroupObj(1);
status.setAppDriverBuffersA = invoke(streamingGroupObj, 'setAppAndDriverBuffers', channelA, ...
pAppBufferChA, pDriverBufferChA, overviewBufferSize);

回答 (1 件)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU 2024 年 1 月 24 日
Hi hsnal,
To acquire data in floating-point format from your “PicoScope 5243D” using MATLAB's Instrument Control Toolbox, you should create a “libpointer” object with a data type of “singlePtr”. This pointer will be used to store single-precision floating-point values.
pAppBufferChA = libpointer('singlePtr', zeros(overviewBufferSize, 1, 'single'));
% singlePtr is the data type for the pointer, indicating single-precision floating point.
%zeros (overviewBufferSize, 1, 'single') initializes a zero-filled array of the specified size (overviewBufferSize) with single-precision floating-point values.
%pAppBufferChA is the name given to the libpointer object, which will be used to store the floating-point data from the PicoScope.
Use this “libpointer” when setting the data buffer in your MATLAB code to ensure that the “PicoScope's” data is stored as floating-point values.
You can refer to the following documentation to know more about the different data types: https://www.mathworks.com/help/matlab/matlab_external/passing-arguments-to-shared-library-functions.html.
I hope this helps!

カテゴリ

Help Center および File ExchangeInstrument Connection and Communication についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by