Argument to dynamic structure reference must evaluate to a valid field name Error occurs when using properties
15 views (last 30 days)
Show older comments
I am trying to use transfer my functional script into App Designer to make it function as a GUI. First thing I did was define all the variables in properties that are going to be used and modified between callbacks:
properties (Access = private)
RTD = cell(5,3);TC = cell(5,3);
end
In my script each cell of RTD is a 5999x9 table, and I am able to referrence the following without errors:
RTD{1,1}.(1)
RTD{1,1}.(1)(1)
But since I made RTD a property in App Designer this causes the error message: "Argument to dynamic structure reference must evaluate to a valid field name":
app.RTD{1,1}.(1)
app.RTD{1,1}.(1)(1)
In the App Designer, I must reference the property RTD as app.RTD.
Does anyone know why this happens and how I could fix it? My only idea would be to make a local variable equal to RTD within the function callback that I need to use RTD in, and then once I am done modifying it, make app.RTD equal to the local variable.
0 Comments
Answers (1)
Bora Eryilmaz
on 2 Feb 2023
Looks like you might be trying to access the content of RTD before populating its cells with the right table content first.
% This works OK.
RTD = cell(5,3);
RTD{1,1} = array2table(rand(10,3));
RTD{1,1}.(1)
% Errors out since the table content is not assigned into the cell array.
RTD = cell(5,3);
RTD{1,1}.(1)
0 Comments
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!