Properties not getting saved in MATLAB App Designer

5 views (last 30 days)
I need to use some variables across my app. For this i am saving them as public properties as follows :
properties (Access = public)
ImageDir = dir('.\Images') ;
ImageName ;
end
However, when i am saving the app or trying to run it. the properties seem to disappear :
properties (Access = public)
Property % Description
end
Can someone please tell why this could be happening. I am currently using Matlab R2017a

Answers (2)

Melissa Williams
Melissa Williams on 16 Oct 2017
Please contact the help desk and if possible provide your app so we can investigate further.

Brijesh Shah
Brijesh Shah on 31 Jul 2018
Edited: Brijesh Shah on 31 Jul 2018
Please discard following problem, as It was own bug, and now solved. What mistake i was doing was, 'i was loading a matfile which included all the workspace variable-including 'app'.-this matfile was saved during previous operation. Hence, all the update in properties of 'app' was undone when I loaded matfile inside , MakePlotsButtonPushed. - rookie mistake. I guess this may be the case with some. -----------------------------
Exact Same Problem , pls help, when trying to access, snips of the code is below.
properties (Access = public)
N1val % Value of N1 rpm in fraction
... % several other properties like this.
plotTransientVariableName
plotTransientVariableStatus
end
function startupFcn(app)
% some script which doesnt involve the property of interest
app.plotTransientVariableStatus=[0,0,0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0];
end
function MakePlotsButtonPushed(app, event)
% some script which doesnt involve the property of interest
if app.plotTransientVariableStatus(1)==1
plot(timeVec,n1)
end
end
  1. Properties defined with public access such as 'N1val' are having all the values be it double or vector or char string, except last two 'plotTransientVariableStatus' etc.
  2. This last property is initialized in startupFcn, as shown above.
  3. Its values changes with 'Statebutton' valueChanged function. - in debug, at this point vector 'plotTransientVariableStatus' still exist.
  4. 'MakePlotsButtonPushed' is generated as call back to one push button. at the if statement, matlab thorws error as index exceeds. - on debug mode it is found that inside this function this property is completely empty. - '[]'.
  5. probably, 'plotTransientVariableStatus' is not getting passed to the 'MakePlotsButtonPushed' but all other properties of app is getting passed.
pls help.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!