Compiled version fails when highpass is called "Error using toolboxdir. Could not locate the base directory for dsp/filterdesign'.

2 次查看(过去 30 天)
I have created an App in App Designer which works fine until I compile. Everything still works as expected, except the functionality that uses the 'highpass' function from the Signal Processing toolbox. The log file states:
"Error using toolboxdir (line 54)
Could not locate the base directory for dsp/filterdesign.
I have checked that the toolbox is installed (I even reinstalled it again) and checked the path to the toolbox exists using toolboxdir('signal').
I created a small test app that recreates the problem.The test app simply creates 100 random numbers, plots them and then applies the highpass filter on the click of a button. Again, the application fails once it is compiled.
I read that the Matlab compiler should detect and automatically include any toolbox requirements. I even tried forcing this detection by adding some non-consequential calls to highpass.m . The code for the test application is below.
Can anybody suggest what I am doing wrong?
classdef testHighPass < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
FilterButton matlab.ui.control.Button
GenerateDataButton matlab.ui.control.Button
plotAxes matlab.ui.control.UIAxes
end
properties (Access = private)
data % Description
x
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: GenerateDataButton
function GenerateDataButtonPushed(app, event)
app.data = rand(1, 100);
app.x = 1:100;
hold(app.plotAxes, 'off');
plot(app.plotAxes, app.x, app.data);
hold(app.plotAxes,'on')
end
% Button pushed function: FilterButton
function FilterButtonPushed(app, event)
filt_data = highpass(app.data, 0.8);
plot(app.plotAxes, app.x, filt_data, 'r');
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
% Create plotAxes
app.plotAxes = uiaxes(app.UIFigure);
title(app.plotAxes, 'Data')
xlabel(app.plotAxes, 'X')
ylabel(app.plotAxes, 'Y')
zlabel(app.plotAxes, 'Z')
app.plotAxes.Position = [101 161 446 280];
% Create GenerateDataButton
app.GenerateDataButton = uibutton(app.UIFigure, 'push');
app.GenerateDataButton.ButtonPushedFcn = createCallbackFcn(app, @GenerateDataButtonPushed, true);
app.GenerateDataButton.Position = [74 95 122 37];
app.GenerateDataButton.Text = 'Generate Data';
% Create FilterButton
app.FilterButton = uibutton(app.UIFigure, 'push');
app.FilterButton.ButtonPushedFcn = createCallbackFcn(app, @FilterButtonPushed, true);
app.FilterButton.Position = [399 96 130 35];
app.FilterButton.Text = 'Filter';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = testHighPass
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
  4 个评论
Gojo
Gojo 2024-9-15
"Did you compile the above code example and test if the filter button works?" : Yes, I was able to test the compiled app as well.
Alan
Alan 2024-9-15
编辑:Alan 2024-9-15
Thank you Shubham for your help and taking the time to compile and test the code. Much appreciated.

请先登录,再进行评论。

回答(1 个)

Alan
Alan 2024-9-15
Solved. I uninstalled Matlab and the runtime and reinstalled Matlab and the toolboxes. I didn't install the optional compiler for Excel add-ins. No idea if that has any effect. I set the compiler to download the runtime from the Web.
After this, I ran the compiler as before and now everything works.

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB Compiler 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by