Hi,
I'm having trouble getting the output from the rapid accelerator simulation. I've dug some of the Q&A before but never got them to work.
The situation is:
I have a .m file (called run.m) which calls multiple sim() in a loop. The simulink model 'adc' includes inputs FromWorkspace, output port named "digout" and 1 embedded MATLAB function. I checked the "save to workspace" for output "digout" on simulink 'adc' model.
The way I run simulation is
1. Call run.m, which initialized Cpool, Cp1,Cp0 on the workspace.
for runid=1:10 Cp1 = Cpool(1,runid) Cp0 = Cpool(2,runid) sim('adc') result(runid) = digout.signals.values end
2. Now I tried to build the rapid accelerator model to speed up the simulation (Following Q&A 35991) to create the model once and simulates multiple times.
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget('adc'); for runid=1:10 new_rtp = Simulink.BlockDiagram.modifyTunableParameters(rtp, ... 'Cp0',Cpool(1,runid),....); simout = sim('adc','SimulationMode','rapid', ... 'RapidAcceleratorUpToDateCheck','off', ... 'RapidAcceleratorParameterSets', new_rtp, 'SaveOutput', 'on','OutputSaveName','digout'); result(runid) = simout.get('digout') end
I tried assigning result(runid) = digout directly but it says the variable cannot be found. Then I try save the output to simout.
However, I'm still getting errors
??? No appropriate method, property, or field get for class Simulink.SimulationOutput.But it seems to have something when I usesimout.findans = 'digout'
The question is:
1. Why can't I get the output "digout" successfully when using the rapid build as I did in normal?
2. What should I do to get it work?
Suggestions and answers are much appreciated.
Nick
Best Answer