How to I put Simulink mask icon drawing code in an m-file

2 ビュー (過去 30 日間)
mlimber
mlimber 2013 年 3 月 25 日
I read Seth Popinchalk's post on locating code in m-files rather than in the mask fields. I'd like to do this with my "icon drawing commands" which draws a background image and/or labels ports.
All works fine if I do this in the "icon drawing commands" field of the mask:
image(imread('pic.jpg'))
port_label('input', 1, 'my_input')
But if I put it in DrawMyIcon.m and call that m-file in the "icon drawing commands," then I get a separate figure popping up.
My ultimate aim here is to make this, like the rest of my code, encrypted/obfuscated pcode for distribution to customers.
  2 件のコメント
mlimber
mlimber 2013 年 3 月 27 日
My problem was that my drawMyMask.m file looked like this:
function drawMyMask
image(imread('pic.jpg'))
port_label('input', 1, 'my_input')
The thing throwing it off was the first line -- it needed to be a straight script, not a function. Delete the "function" line, and all works.
Kaustubha Govind
Kaustubha Govind 2013 年 3 月 27 日
mlimber: Thanks for posting your solution! I'd recommend posting it as an answer and accepting it, so it is clear that this question has been resolved.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAuthor Block Masks についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by