Code covered by the BSD License  

Highlights from
Figure to Simulink subsystem mask icon converter

5.0

5.0 | 2 ratings Rate this file 8 Downloads (last 30 days) File Size: 2.75 KB File ID: #28198
image thumbnail

Figure to Simulink subsystem mask icon converter

by Paul

 

13 Jul 2010

Creates a mask icon for a Simulink subsystem from a given figure.

| Watch this File

File Information
Description

Creates a mask icon for a Simulink subsystem from a given figure. This subsystem is masked with a ICON correspoding to lines in the figure. This is useful to illustrate the behaviour of the subsystem by a icon.

You can use the simplot command to create it from the actual output. See the documentation of simplot (doc simplot) for further info.

FUNCTION:
function fig2simulinkmaskicon(hFig,colors)

INPUTS:
hFig - handle to a figure to be used (e.g. gcf)
colors - (OPTIONAL) colors for different lines.

Supported (default) colors: blue, red, green, magenta, yellow, cyan, black

OUTPUTS:
Creates a simulink subsystem with a given mask
Prints out the Mask/Icon string in the command window.

Example:
h = figure; hold on;
plot([0:0.1:10],sin([0:0.1:10]));
plot([0:0.5:12],cos([0:0.5:12]));
fig2simulinkmaskicon(gcf);
fig2simulinkmaskicon(gcf,'yellow');
fig2simulinkmaskicon(gcf,{'red','magenta'});

Required Products Simulink
MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
14 Jul 2010 Lukas Lansky  
15 Jul 2010 Lukas Lansky

Actually works very nicely.

13 Dec 2010 Will Campbell

This is a handy utility for 2D plot conversion. However, it doesn't work so well with 3D or image plots though. You might want to rephrase the description to note this limitation. It would also be handy if the function would error out unless the figure is 2D.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
mask Paul 14 Jul 2010 09:49:34
simulink Paul 14 Jul 2010 09:49:34
subsystem Paul 14 Jul 2010 09:49:34
figure Paul 14 Jul 2010 09:49:34
convert Paul 14 Jul 2010 09:49:34
conversion Paul 14 Jul 2010 09:49:34
icon Paul 14 Jul 2010 09:49:34
line Paul 14 Jul 2010 09:49:34
plot Paul 14 Jul 2010 09:49:34

Contact us at files@mathworks.com