Need help for Instrument Control Toolbox with PicoScope 5000a
조회 수: 1 (최근 30일)
이전 댓글 표시
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);
댓글 수: 0
답변 (1개)
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Instrument Connection and Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!