Argument to dynamic structure reference must evaluate to a valid field name Error occurs when using properties
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Bora Eryilmaz
2023-2-2
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!