MATLAB Function block containing a locally defined "struct" outputs an error that the struct is not defined
Ältere Kommentare anzeigen
I have a MATLAB Function block (MLFB) that contains the below script:
simParameters = []; % Clear the simParameters variable
simParameters.NumFramesSim = 30; % Simulation time in terms of number of 10 ms frames
simParameters.NumUEs = 4;
simParameters.UEDistance = [100; 400; 1500; 1000];
The code is simply creating a "struct" "simParameters" that has a few "double" elements. The above script would execute just fine in a regular MATLAB script. But, in the MLFB, when I run the model, I get the below error message:
Error:Attempt to extract field 'NumFramesSim' from 'double'.
Function 'Function-Call Subsystem/MATLAB Function' (#24.156.169), line 8, column 1:
"simParameters"
Launch diagnostic report.
Error:Attempt to extract field 'NumUEs' from 'double'.
Why does this script execute nominally in a regular MATLAB script but throws the above errors in MLFB?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Event Functions finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!