From: Olli-Pekka Hämäläinen on
Hi,

I have written a function that creates me data points according to user-given parameters and I'd like to develop a gui for it. I have 8 edit text fields and one popupmenu where to specify the data parameters. Then I have one push button ('Create!') and two figures. The edit text-fields should work fine, but I'm having three troubles:

1) The popupmenu keeps bugging me with an error:

Warning: popupmenu control requires a scalar Value
Control will not be rendered until all of its parameter values are valid.

All I've done is that I have popupmenu with strings 'Linear' and 'Semi-logarithmic' and values 1 and 2 respectively. What's wrong with this?

2) When the user has specified all parameters, how do I run the function that has already been written as an external function (named CreateTPs)?

3) First figure should show a histogram of the data and 2nd one a time series 2D plot of the data spectrum. Guidelines/good tutorial anyone? The tutorials I googled don't help much on this.

Huge thanks to anyone who solves even 1 of those!
From: Steven Lord on

"Olli-Pekka Hämäläinen" <olli-pekka.hamalainen(a)lut.fi> wrote in message
news:i0fbia$77d$1(a)fred.mathworks.com...
> Hi,
>
> I have written a function that creates me data points according to
> user-given parameters and I'd like to develop a gui for it. I have 8 edit
> text fields and one popupmenu where to specify the data parameters. Then I
> have one push button ('Create!') and two figures. The edit text-fields
> should work fine, but I'm having three troubles:
>
> 1) The popupmenu keeps bugging me with an error:
>
> Warning: popupmenu control requires a scalar Value
> Control will not be rendered until all of its parameter values are valid.
>
> All I've done is that I have popupmenu with strings 'Linear' and
> 'Semi-logarithmic' and values 1 and 2 respectively. What's wrong with
> this?

The Value property of a popupmenu controls which item is selected.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/uicontrol_props.html#Value

If you've set it to the vector [1 2] then the popupmenu doesn't know which
element to display, and so it warns you that it doesn't know what to do and
waits for you to fix the problem. Note that uicontrols of Style 'listbox'
DO allow the Value property to be nonscalar; that's because you can select
multiple items from a listbox. But only one item can be displayed by a
popupmenu (when you haven't expanded the popupmenu to allow selection.)

In whatever callback function needs to know which string is selected, you'd
GET the Value property of the popupmenu and use that as an index into the
cell array (I assume you're using a cell array here) that you retrieved from
the String property of the popupmenu if you need the actual string.

> 2) When the user has specified all parameters, how do I run the function
> that has already been written as an external function (named CreateTPs)?

Either have each callback check to see if all the parameters have been
specified and/or have a "Run" button that the user can press whose callback
retrieves the parameter values and runs your external function. Frankly, I
prefer the latter; that way if the user makes a mistake they have a chance
to go back and correct it before the (possibly long-running) external
function starts computing.

> 3) First figure should show a histogram of the data and 2nd one a time
> series 2D plot of the data spectrum. Guidelines/good tutorial anyone? The
> tutorials I googled don't help much on this.

Take a look at the HIST and PLOT functions. I would recommend explicitly
creating axes on the appropriate figure and passing those axes handles into
HIST or PLOT to ensure that they plot into the correct axes.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Olli-Pekka Hämäläinen on
Thanks, this advice added to some more research did the trick!

Going on to (hopefully) my final problem:

My external function produces some warnings if the user parameters are not well-suited. These warnings appear to the Matlab main command line and user has to press enter to proceed (I made this rule by myself).
How could I get these warnings appear on the GUI? A static text field or a popup warning window would be fine, since I'm planning to use the Matlab compiler to make this program into a standalone.

I know there are some ways, but could you show me the shortest one. Thanks.