App designer - How do i clear all variables?

조회 수: 28 (최근 30일)
youjarr
youjarr 2019년 3월 13일
편집: Robin 2019년 6월 30일
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!

답변 (1개)

Robin
Robin 2019년 6월 30일
편집: Robin 2019년 6월 30일
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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by