Borrar filtros
Borrar filtros

Clear Properties in App Designer

41 visualizaciones (últimos 30 días)
THULYO NEDER
THULYO NEDER el 28 de En. de 2021
Editada: Adam Danz el 29 de En. de 2021
I have a Property in my App Designer defined as ''Index''.
This Property is used in most of my callback functions to access specific values.
However, before start to run any callback function, I need to ''clear'' the value of this Property so that I do not have influence of previous values in the callback I'm current running.
I tried to use
clearvars app.Index
but did not have the expected result.
Any ideas?

Respuesta aceptada

Adam Danz
Adam Danz el 28 de En. de 2021
Editada: Adam Danz el 28 de En. de 2021
> I need to ''clear'' the value of this Property so that I do not have influence of previous values in the callback I'm current running
You can clear the content of that property using
app.Index = []; % numeric data
app.Index = {}; % cell arrays
app.Index = ''; % character arrays
app.Index = ""; % strings
% etc...
That can be used as a flag to ignore a section of code,
if ~isempty(app.Index)
% stuff
end
Addendum
To create an empty table
app.Index = table();
To clear a table and maintain the headers
app.Index(:,:) = []; % Preserves the class of each column
% or
app.Index = table([],[],{}); % Creates a new 0x3 table and defines classes for each column
  4 comentarios
THULYO NEDER
THULYO NEDER el 28 de En. de 2021
Thanks Adam.
It worked!
Adam Danz
Adam Danz el 28 de En. de 2021
Editada: Adam Danz el 29 de En. de 2021
Thanks for the feedback, @THULYO NEDER
I've updated the answer to provide a better method of clearing a table,
app.Index(:,:) = [];
This method preserves the class of each column.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by