namefig

NAMEFIG Create or focus a figure with a specific name and set its properties.
0 Downloads
Updated 16 Jun 2024

View License

% NAMEFIG Create or focus a figure with a specific name and set its properties.
%
% FIG = NAMEFIG(NAME) creates a new figure with the specified NAME if
% it does not already exist. If a figure with the specified NAME
% exists, it brings the figure to the front.
%
% FIG = NAMEFIG(NAME, 'PropertyName', PropertyValue, ...) sets the
% specified properties of the figure. If 'size' is specified as a
% property name, it sets the size of the figure window.
%
% Example:
% fig1 = namefig('MyFigure', 'size', [400 300]);
% fig2 = namefig('AnotherFigure', 'Color', 'r', 'NumberTitle', 'off');
%
% Inputs:
% NAME - A string specifying the name of the figure.
%
% Optional Property-Value Pairs:
% 'size' - A vector [width height] specifying the size of the figure window.
% Other - Any valid figure property name and its corresponding value.
%
% Outputs:
% FIG - The handle to the created or existing figure.
%
% Notes:
% - If 'size' is specified, it overrides the default size of the figure.
% - Other property-value pairs are applied to the figure using the SET function.
% - If an invalid property name is specified, a warning is displayed.
%
% See also FIGURE, SET, FINDOBJ.

Cite As

宏樹 長嶋 (2026). namefig (https://uk.mathworks.com/matlabcentral/fileexchange/168211-namefig), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
1.0.0