need help on getting output from rapid accelerator simulation

Asked by Nick Huang on 29 Jun 2012
Latest activity Answered by Nick Huang on 30 Jun 2012

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 use
simout.find
ans = 
    '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

0 Comments

Nick Huang

Products

2 Answers

Answer by Walter Roberson on 29 Jun 2012
Accepted answer

My speculation would be that your version of Simulink predates the Simulink.SimulationOutput.get method.

The documentation I am glancing at implies you might be able to use

result(runid) = simout.find('digout');

1 Comment

Adam Filion on 29 Jun 2012

As far as I know, simout.find and simout.get are the same thing, and in the current version they both work for me. From the error message I agree that it looks like this is an older version that doesn't have simout.get, though I find it odd that nothing is mentioned in the release notes about it getting added. Wouldn't be the first time something was omitted there though.

Walter Roberson
Answer by Nick Huang on 30 Jun 2012

Thank you Walter and Adam. It does seem like my matlab version is quite old (2009b) and the function isn't until later version. The simout.find('varname') works perfect. Thanks for the quick response

0 Comments

Nick Huang

Contact us