App designer - How do i clear all variables?

28 Ansichten (letzte 30 Tage)
youjarr
youjarr am 13 Mär. 2019
Bearbeitet: Robin am 30 Jun. 2019
Hey guys,
I created an App within App designer.
It works in mostly all cases perfect... except in one case.
This case is if I load a second smaller (with less datapoints) mat file then I get an error:
% Error using horzcat
% Dimensions of arrays being concatenated are not consistent.
%
% Error in app3/LoadFile (line 1228)
% AllHallsInOne_Deg = [Hall_1 DegAllHalls; Hall_2
% DegAllHalls; Hall_3 DegAllHalls];
%
% Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
% Error while evaluating Button PrivateButtonPushedFcn.
I´m understanding the error but it should not appear? Because im deleting the relevant variables and let the app create and fill the variables. But it seems that it is not deleting the data and it trys to concatenate the old variable with the new or adds the new to the old data.
So the question is how do I delete variables/parameters properly in app designer?
I tried
clear varname
or
varname = []
also
delete(varname)
It is my first app... but I´m not able to handle this problem.
Thanks in advance!

Antworten (1)

Robin
Robin am 30 Jun. 2019
Bearbeitet: Robin am 30 Jun. 2019
the merit goes to a teacher who helped me a lot
delete(app.UIFigure); %close the app
GUI_name; %re-open it again
It's the easiest way to do it

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by