MATLAB Answers

Extracting values from fields in app designer

1 view (last 30 days)
Alexandra Philip
Alexandra Philip on 13 Jul 2020
Commented: Sourabh Kondapaka on 14 Aug 2020
I am trying to figue out how to obtain the values from certain fields within my struct in app desginer.
I would like to pull the struct from a .mat file.
I first am using:
properties (Access = private)
Mystruct % Description
properties (Access = public)
methods (Access = private)
function Start(app)
Then I should be able to use app.Mystruct in my callback function to load the struct. Any suggestions on obtaining the values from certain fields such as SERIAL_NUMBER?


Show 3 older comments
Sourabh Kondapaka
Sourabh Kondapaka on 13 Aug 2020
Could you please upload the 'AccelQuery.mat' file for me to cross check.
J. Alex Lee
J. Alex Lee on 13 Aug 2020
If a .mat file is meant to contain a single structure variable, but "save"d without using the "-struct" option, you'll have to access the struct by invoking the name of the original structure's variable. So if I have
S.a = 1
S.b = 2
S.c = 3
To access the fields a, b, c from loaded data, I need to do
loadedS = load("testdata.mat")
If you want to be able to do
then you have to save as
Maybe that's what Sourabh is going to check...
Sourabh Kondapaka
Sourabh Kondapaka on 14 Aug 2020
@J.Alex Lee is right in suggesting what I was going to check.
If his comment still does not solve the issue, please upload the 'AccelQuery.mat' for me to cross check.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!