simulink_root does not have a parameter named 'PaperType'

My code is using the following to set the paper type for Simulink. Howerver, I am getting the following error: simulink_root does not have a parameter named 'PaperType'.
set_param(0,'PaperType','A4'); % Simulink
Note: A similar command is used on the line before to set the paper type for MATLAB and that one works (see below). Also the same code runs on R2011b but it fails on R2025b after conversion.
set(0,'DefaultFigurePaperType','a4'); % Matlab

5 Commenti

Don't have Simulink but AI engine says the root 'PaperProperty' wasn't removed, but it also says recommended practice is now to query the particular model and set it for it instead...
% Get the handle to the currently active Simulink figure
h = get_param(gcs, 'Handle');
% Set figure properties before exporting
set(h, 'PaperType', 'A4');
I'd suggest trying that and seeing what happens...it does seem strange wouldn't be in the root object, though.
See if that will get you by for the time being until somebody who actually knows something comes by.
Doing this generated the following error:
Invalid Simulink object name: ''.
Caused by:
Error using
Empty object name found.
NOTE: My *.m file is run from MATLAB without having Simulink open. Once it is run, then I can open my Simulink model. It appears to me that the 'PaperType' property no longer exists in R2025b (might have been merged into a single property on the MATLAB side to avoid redundancy), whereas it used to exist back in R2011b, hence, requiring defining it for MATLAB and Simulink separately through two different code lines.
I also tried replacing the gcs with 0 and I got the following error:
Error using set
Unrecognized property PaperType for class Root.
Error in
set(h, 'PaperType', 'A4');
By the way, for set_param(0,'PaperType','A4')
R2018a reported
Warning: Clearing the current default model template so that new models will inherit this property of the root block diagram. To restore the default
model template call Simulink.defaultModelTemplate('$restore') or restart MATLAB. For more information, see the documentation.
Thank you, Walter. This is helpful information. I very much appreciate you contributing to my historical building of this parameter from R2011b to R2025b.

Accedi per commentare.

 Risposta accettata

R2022b reports
Warning: Getting parameter 'PaperType' of the default block diagram will not be supported in a future release.
Warning: Setting parameter 'PaperType' of the default block diagram will not be supported in a future release because new models inherit parameter values from templates.
Warning: Clearing the current default model template so that new models will inherit this property of the root block diagram. To restore the default model template call Simulink.defaultModelTemplate('$restore') or restart MATLAB. For more information, see the
documentation.
By R2023b, the facility was gone.

1 Commento

Fantastic, this is exactly the historical data I needed. Thanks a lot, Walter!

Accedi per commentare.

Più risposte (0)

Prodotti

Release

R2025b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by