From: timo on
Hello all,

I'm creating a matlab script file that prints out a Simulink model (.MDL) in a directory to PDF files. Currently I got it to the point that the script will print out the currently opened model, however, it does NOT print out any of its subsystems.

I would like the model's subsystem to be printed under the same PDF file as page 2 onwards.... can anyone give me a hand?

The printing function that I use is:
print('-dpdf','-sFilename')

Thanks in advance!
From: Saurabh Mahapatra on
Hi,

Try this piece of code:

mdlname='sldemo_counters';
% Be invisible
load_system(mdlname);
a=find_system(gcs);

% Print the root separately as BlockType is not a property
foo=a(1);
lambda=get_param(a(1), 'Handle');
saveas(lambda{1}, [foo{1} '.pdf']);

% Print only subsystems
for i=2:length(a)
if (strcmp(get_param(a(i), 'BlockType'), 'SubSystem'))
foo=regexprep(a(i), '/', '_');
foo=regexprep(foo, '\s','');
lambda=get_param(a(i), 'Handle');
saveas(lambda{1}, [foo{1} '.pdf'])
end
end
close_system(mdlname)

Thanks,

Saurabh
 | 
Pages: 1
Prev: simulink memory problem
Next: libeng.lib win64