App Designer class properties visibility

Hi all,
I am just learning about classes in Matlab. This morning I had a custom class defined and when using an object of that class in App Designer I would get an interactive list of the objects properties after writing the '.' after the object name. Pretty much like you do for any control on the GUI (example):
However, for some reason, I stopped getting this list for my custom class. Not knowing the reason, I stripped the class down until the bear minimum, thinking it might be a parse problem in the class. But still no success. So eventually I tried the auto generated class template of Matlab and created a basic class called Class1 and tried to use this one in App Designer, but still, I get no interactive list of Properties. My class looks like this:
classdef Class1
properties (Access = public)
Property1
end
methods
function obj = Class1(inputArg1,inputArg2)
obj.Property1 = inputArg1 + inputArg2;
end
function outputArg = method1(obj,inputArg)
outputArg = obj.Property1 + inputArg;
end
end
end
And my app designer code looks like this (just a basic figure, with nothing added:
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
Module = Class1(1,2);
Module.
end
end
So at this point, I would expect after the '.' the list showing me 'Property1' to pop up, but it does not appear.
Any ideas? Thanks.

Answers (1)

I found it seems myself the answer to this question, I'll just post it here, in case others run in the same trouble. In order for the drop-down list of properties and methods to be available in Code View, you must fist declare the Module as a property of the app and indicate its class like this:
properties (Access = public)
Module Class1;
end
Then you can further use it in the code and access its public properties and methods:
Untitled.png
Best regards,
Cristian

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Release

R2019a

Asked:

on 12 Sep 2019

Answered:

on 18 Sep 2019

Community Treasure Hunt

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

Start Hunting!