I want to create a GUI for the program to start a real time plotting through Data Logger, but before I can proceed I have trouble defining the code below, where should I place them and how should I start?

1 回表示 (過去 30 日間)
PHUN
PHUN 2013 年 7 月 15 日
回答済み: Pico Technology 2014 年 11 月 13 日
%---------- Load PicoLog 1000 series Library ----------% %loadlibrary('PL1000.dll','pl1000Api.h'); loadlibrary 'PL1000.dll' 'pl1000Api.h' addheader 'picoStatus.h'; if ~libisloaded('PL1000') error('Library pl1000.dll or pl1000Api.h not found') %Check if library file loaded end
%-------------------- Program -------------------% %% -- Open and enumerate the unit -- handle = libpointer('int16Ptr',zeros(1,1)); % short handle
[status_open, handle] = calllib('PL1000', 'pl1000OpenUnit', handle); fprintf('Opening the device \n');
%% -- Retrieved Maximum value from the data logger -- max_Value = libpointer('uint16Ptr',zeros(1,1)); % Max value
calllib('PL1000','pl1000MaxValue', handle, max_Value); maxValue = get(max_Value,'Value'); maxValue = double(maxValue); % Convert int16 to double fprintf(' Max value = %f\n',maxValue);

回答 (1 件)

Pico Technology
Pico Technology 2014 年 11 月 13 日
Hi,
If you are still having issues with your code the following might help:
  • Ensure that the pl1000.dll, on your MATLAB path
  • Check that you have configured a C compiler using mex -setup
  • If you are using a 64-bit version of MATLAB for Windows, please ensure that you have installed Windows SDK 7.1 as per How do I install Microsoft Windows SDK 7.1?
The following code might help:
loadlibrary 'pl1000.dll' 'pl1000Api.h' addheader 'picoStatus.h';
global data;
data.unithandle = 0;
data.maxValue = 0;
%%Open unit
% Open the unit - returns a handle to the device
[status_open, data.unithandle] = calllib('pl1000', 'pl1000OpenUnit', data.unithandle)
%%Maximum ADC value
% Obtain the maximum ADC value
[status_max_value, data.maxValue] = calllib('pl1000', 'pl1000MaxValue', data.unithandle, data.maxValue)
%%Close the unit
status_close = calllib('pl1000', 'pl1000CloseUnit', data.unithandle)
unloadlibrary('pl1000');

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by