Error using extractfield in app designer

3 visualizaciones (últimos 30 días)
Alexandra Philip
Alexandra Philip el 10 de Jul. de 2020
Comentada: Matt J el 11 de Jul. de 2020
I am attempting to extract the values from specific fields of a structure in app designer.
I first added a private property(app.Mystruct) and a function which loads the struct from a mat file.
properties (Access = private)
Mystruct % Description
end
properties (Access = public)
end
methods (Access = private)
function Start(app)
Mystruct=load('AccelQuery.mat')
end
end
In the call back function I used:
rmdData=app.Mystruct;
rmdData.SERIAL_NUMBER=extractfield(rmdData,'SERIAL_NUMBER');
In an effort to extract the values from that field('SERIAL_NUMBER').
I then receive this error:
Error using extractfield
Expected input number 1, S, to be one of these types:
struct
Instead its type was double.
Error in extractfield (line 39)
validateattributes(S, {'struct'}, {'vector'}, fcnname, 'S', 1)
Any suggestions to correct this error?

Respuestas (1)

Matt J
Matt J el 10 de Jul. de 2020
Editada: Matt J el 10 de Jul. de 2020
The error message has told you that rmdData, as fed to extractfield, is not a struct. You should check what it actually is, and how it got that way.
  2 comentarios
Alexandra Philip
Alexandra Philip el 11 de Jul. de 2020
I checked rmdData and it is saying that it is a struct.
Matt J
Matt J el 11 de Jul. de 2020
Well, attach rmdData in a .mat file so that we can try to reproduce the error.

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by