How do I import classes on GUI Matlab?

7 Ansichten (letzte 30 Tage)
Alessandro Sardellitti
Alessandro Sardellitti am 22 Feb. 2022
Beantwortet: Hornett am 6 Okt. 2023
Hello everyone! I am trying to develop a Matlab GUI with App Designer. A "Tie-Pie" acquisition card is used in the program and it is necessary to import the library.
In the classic programs I insert the following code and everything is defined but when I use the development environment of the GUI I get the following error "Unrecognized function or variable 'LibTiePie'.".
How can I get the "import" command to work properly in these cases?
import LibTiePie.Const.*
import LibTiePie.Enum.*
if ~exist('Lib_TiePie', 'var')
LibTiePie = LibTiePie.Library;
else
clearvars -except Lib_TiePie
end
LibTiePie.Network.AutoDetectEnabled = true;
......
  1 Kommentar
Tim Coope
Tim Coope am 16 Mär. 2022
Hi Alessandro,
I got the same issue, did you find a solution?
thanks!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Hornett
Hornett am 6 Okt. 2023
Hi Alessandro,
I understand that you are facing issues while importing classes in your app.
You can directly import classes into your functions by writing import statements. In your case "import LibTiePie.Const.*" and "import LibTiePie.Enum.*" should be inside the function you are calling.
I suggest you to reffer to this documentaion for better understanding : https://www.mathworks.com/help/matlab/matlab_oop/importing-classes.html
I hope this information helps.

Kategorien

Mehr zu Communications Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by