Does the Digilent Toolbox Add-On work with Matlab Library Compiler?

1 Ansicht (letzte 30 Tage)
Does the Digilent Toolbox work with the Matlab Library compiler? I'm attempting to deploy a matlab .NET application, but when the deployed application runs the command
AO = daq("digilent")
it returns the exception "Specify an operational vendor" which tells me it doesn't have the Digilent Toolbox info included in the compiled application.
I also don't see Digilent Toolbox in the Suggested Support Packages in the Library Compiler application window.
  2 Kommentare
Vinayak
Vinayak am 24 Apr. 2023
If the question pertains to whether the Digilent toolbox itself can be compiled using the MATLAB Library Compiler, then we unfortunately cannot do it because it is an add-on to MATLAB that provides additional functionality and not a standalone due to which it cannot be compiled on its own.
If you plan to encompass the Digilent Toolbox functions in your MATLAB code, and then compile that code using the MATLAB Compiler, then yes, it is possible. However, you would need to ensure that the Digilent Toolbox is installed on the target machine where the compiled application will run.
Michael Sonnenberg
Michael Sonnenberg am 24 Apr. 2023
Bearbeitet: Michael Sonnenberg am 24 Apr. 2023
Hi Vinayak, thanks for the response. See the code shown below. My problem is that "digilent" is not recognized as a daq option on the target machine specifically when this line of code is run:
AO = daq("digilent"); % DAQ session for the AWG channel
I installed MATLAB runtime on the target machine, and everything else seems to be working as expected. How do I ensure that the Digilent Toolbox is installed on the target machine? I was assuming it would be included when compiled, but this appears not to be the case...?
function [status] = FactoryThermalModuleVibrationCapture_ms00(capture_path,file_name,capture_time,duty)
% Required Hardware:
% Audio DAQ with ASIO driver and IEPE power. Currently using Echo AIO (Echo Test & Measurement)
% Power Source / Function Generator. Currently using Digilent Analog
% Discovery 2.
% capture_path - folder location on local drive
% file_name - wav file name = "asdf.wav"
% capture_time - time of capture in seconds
% duty - % duty cycle [0.0, 1.0]
% Initialize Audio Device:
fs = 48e3;
blocksize = 1024;
deviceReader = audioDeviceReader(...
'Driver','ASIO',...
'Device','ASIO Echo AIO',...
'SampleRate',fs,...
'BitDepth','24-bit integer',...
'ChannelMappingSource','Property',...
'ChannelMapping',[1,2]);
fileWriter = dsp.AudioFileWriter(file_name);
fileWriter.SampleRate = fs; % Capture at same sample rate as stimuli
fileWriter.FileFormat = "WAV";
fileWriter.DataType = "int24";
daqreset;
AO = daq("digilent"); % DAQ session for the AWG channel
VP = daq("digilent"); % DAQ session for the V+ power supply
% Start background +5V
addoutput(VP, "AD2_0", "V+", "Voltage");
VP.Rate = 10; % Rate is 10 Hz
T = 1; % Frame seconds
V = 5; % Amplitude
output01 = V*ones(VP.Rate*T,1);
start(VP,"repeatoutput");
write(VP,output01);
pause(3);
% Start background Analog Out PWM Signal
% Create the PWM signal
N = 40;
% n = 0:N-1;
PWM_fs = 25e3;
rate = N*PWM_fs;
% dt = 1/rate;
% T = N*dt;
% t = n/rate;
N_on = floor(N*duty);
N_off = N - N_on;
PWM_output = [5*ones(N_on,1); zeros(N_off,1)];
% hfig = figure(1);
% hfig.Visible = "on";
% hplot = plot(n,PWM_output);
% hplot.LineWidth = 1.5;
% grid on
% xlabel('Samples (n)')
% ylabel('PWM Out')
PWM_output = repmat(PWM_output,PWM_fs,1);
addoutput(AO, "AD2_0", "ao0" ,'Voltage');
AO.Rate = rate;
preload(AO,PWM_output);
cd(capture_path)
N_frames = ceil(capture_time*fs/blocksize);
N_OverRuns = zeros(N_frames,1);
ii_frame = 1;
start(AO,"repeatoutput");
pause(3);
while ii_frame <= N_frames
[acquiredAudio, N_OverRuns(ii_frame)] = deviceReader();
fileWriter(acquiredAudio);
ii_frame = ii_frame + 1;
end
release(deviceReader);
release(fileWriter);
stop(AO)
stop(VP)
if sum(N_OverRuns)
status = 0;
else
status = 1;
end
end

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Signal Generation and Preprocessing finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by