App designer - How do i clear all variables?

32 ビュー (過去 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 Center および File ExchangeDevelop 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