From: Eric Brewer on
"Eric Brewer" <piano_man354(a)yahoo.com> wrote in message <hmjqeq$eb6$1(a)fred.mathworks.com>...
> "Arkadiy Turevskiy" <arkadiy.turevskiy(a)mathworks.com> wrote in message <hmjo7h$il5$1(a)fred.mathworks.com>...
> > if you have a model file model.mdl and report setup file reportcustom.rpt,
> >
> > >>myreport('model','reportcustom.rpt')
> >
> > where
> >
> > function [ ] = myreport(mymodelname,myreportname)
> > % Model must be loaded.
> > load_system(mymodelname)
> > % Associate model with report name. Needs to be done once if saved.
> > set_param(mymodelname,'ReportName',myreportname)
> > save_system(mymodelname);
> > % Generate report.
> > report(mymodelname)
> > close_system(mymodelname)
> > end
> >
> > Arkadiy
> >
> > > Arkadiy,
> > > Thanks for the response. Unfortunately, I can't find the if statements that you mention. Also, I believe this would make the template specific to one model. Is there any way to pass in the model name to a function, such that I can generate the report from this template regardless of the model name? Thanks in advance.
> > >
> > > -Eric
>
> That's exactly what I was looking for. Thanks!

I just noticed that occasionally (maybe 1 in 10) the command "myreport(mymodelname,myreportname)" will still generate a random report for dpstat30, or eml0, instead of mymodelname. Is this a bug? Thanks in advance.
From: Arkadiy Turevskiy on
Hard to say what is going on without having all your files. You can submit a help request and tech support will help you:
http://www.mathworks.com/support/product/product.html?product=SR
the link that says "create a new service request".
Arkadiy


> I just noticed that occasionally (maybe 1 in 10) the command "myreport(mymodelname,myreportname)" will still generate a random report for dpstat30, or eml0, instead of mymodelname. Is this a bug? Thanks in advance.
From: Arkadiy Turevskiy on
Oy you could try a simpler code that should work as well assuming you use Model Loop component whci is set to report on current block diagram:

function [ ] = myreport(mymodelname,myreportname)
load_system(mymodelname)
report(myreportname)
close_system(mymodelname)
end

Also use different names for a Simulink model and for .rpt file.

Arkadiy