Thread Subject: Customize parameter dialog of own simulink blocks (coded in c)

Subject: Customize parameter dialog of own simulink blocks (coded in c)

From: Sebastian Pliefke

Date: 11 Nov, 2009 09:13:03

Message: 1 of 4

Hi there

In the last days I developed a lot of customized simulink blocks in C to build up an environment for an image processing application in simulink. Thereby I reached several points which limit myself in develop a better HMI for my blocks. Maybe this forum can point to further information of develop customized blocks or can answer my question I wrote below.

1. Is it possible to change the label of the in- or outport at runtime?
Sometimes I would like to change the number of in- or outport according to parameter settings. Every time if I change the number of port later on all textual label I insert in the mask dialog doesn't fit anymore. I think I need a function available under c to change the labels of port at runtime.

2. The same question as above I've for the parameter stuff. I developed a block which has a combo box to set up the behaviour of the block. I would like to change the entries of this particular combo box at runtime. Currently I entered all entries in the mask dialog offline.

Thx4Help
Sebi

Subject: Customize parameter dialog of own simulink blocks (coded in c)

From: Ralph Schleicher

Date: 15 Nov, 2009 13:25:52

Message: 2 of 4

"Sebastian Pliefke" <sebastian.pliefke@magnaelectronics.eu> writes:

> 1. Is it possible to change the label of the in- or outport at
> runtime?

Yes.

> Sometimes I would like to change the number of in- or
> outport according to parameter settings.

set_param(h, 'MaskSelfModifiable', 'on')

> Every time if I change the
> number of port later on all textual label I insert in the mask dialog
> doesn't fit anymore. I think I need a function available under c to
> change the labels of port at runtime.

You want to do that in Matlab inside of the mask dialog box.

> 2. The same question as above I've for the parameter stuff. I
> developed a block which has a combo box to set up the behaviour of the
> block.

Combo box means popup menu in Matlab jargon, right?

> I would like to change the entries of this particular combo box
> at runtime. Currently I entered all entries in the mask dialog
> offline.

A popup menu offers a choice. So why do you want to change the
choice? You should rethink your user interface.

--
Ralph

Subject: Customize parameter dialog of own simulink blocks (coded in c)

From: Sebastian Pliefke

Date: 16 Nov, 2009 08:30:04

Message: 3 of 4

Hi Ralph

Thx for your responce.

> > I would like to change the entries of this particular combo box
> > at runtime. Currently I entered all entries in the mask dialog
> > offline.
>
> A popup menu offers a choice. So why do you want to change the
> choice? You should rethink your user interface.
I know it's an uncommon use of the matlab block but I've a serious argument to change the combo entries later on.
My Matlab block makes a connection between Matlab and a database where I store several timelines with application data. The number and names of these timelines will varies over the time of the project. The combo element should be the main selection point of which timeline is under investigation. To avoid a rebuilt of the block by every change of the timeline definition I tried to configure the block by themselves using the database.

Does anyone know if there is an access point to the combo entries or I waste my time with it?

Sebi

Subject: Customize parameter dialog of own simulink blocks (coded in c)

From: Ralph Schleicher

Date: 16 Nov, 2009 20:33:53

Message: 4 of 4

"Sebastian Pliefke" <sebastian.pliefke@magnaelectronics.eu> writes:

> I know it's an uncommon use of the matlab block but I've a serious
> argument to change the combo entries later on. My Matlab block makes
> a connection between Matlab and a database where I store several
> timelines with application data. The number and names of these
> timelines will varies over the time of the project. The combo element
> should be the main selection point of which timeline is under
> investigation. To avoid a rebuilt of the block by every change of the
> timeline definition I tried to configure the block by themselves using
> the database.

I see. That makes sense for a small number of timelines.

> Does anyone know if there is an access point to the combo entries or I
> waste my time with it?

If 'i' is the index of the timeline parameter, something like

  style = get_param(h, 'MaskStyles');
  style{i} = 'popup(A|B|C|D|E|F)';
  set_param(h, 'MaskStyles', style);

should do it. I suppose 'MaskSelfModifiable' has to be 'on', too.

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
customize blocks Sebastian Pliefke 11 Nov, 2009 04:14:10
simulink Sebastian Pliefke 11 Nov, 2009 04:14:10
inport Sebastian Pliefke 11 Nov, 2009 04:14:10
outport Sebastian Pliefke 11 Nov, 2009 04:14:10
port label Sebastian Pliefke 11 Nov, 2009 04:14:10
combo box entries Sebastian Pliefke 11 Nov, 2009 04:14:10
rssFeed for this Thread

Contact us at files@mathworks.com