How to have a user prompt window to submit real time values

1 回表示 (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2019 年 1 月 31 日
編集済み: madhan ravi 2019 年 1 月 31 日
Hi
I am using a Local Gaussian Distribution algorithm to auto segment some images.
This algorithm contains a few parameters as optimization parameters. A few of them are, kernel size, time step, number of iterations, outer/inner weight, length and data terms and more.
By tuning those parameters you get different segmentation results and different behaviour of the active contour.
What I need is a panel, with boxes (same number of boxes as the parameters), that the user shall be able to modify all those values while performing the auto segmentation. For instance, if a higher number of iterations are necessary then he/she shall go and adjust acordingly the Number of Iterations Box, and he can also experiement with the other boxes at the same time. The active contour should change behaviour and characteristics as the values are changing real time.
Is this possible?
Thanks

採用された回答

Guillaume
Guillaume 2019 年 1 月 31 日
編集済み: Guillaume 2019 年 1 月 31 日
@Stelios, The questions I've seen from you today could easily be answered by thinking a bit more about what you're doing and actually reading the documentation of the functions you use.
Using the debugger would also help you understand why the code you write doesn't work.
I'm not sure why you even expected the code you wrote to work:
%create a cell of char arrays
us = {'Iterations:','Time Step:', 'Kernel Size (sigma):', 'Data Term Weight'};
%convert that cell array of char arrays into a matrix
t = cell2mat(us); %could have used t = [us{:}];
After that, t is
>>t
t =
'Iterations:Time Step:Kernel Size (sigma):Data Term Weight'
You then have
e = str2num(t); %convert text to number
What do you expect to happen when t is the above?
>> e
e =
[]
So e is of course empty since the text does not represent a number. Of course, trying to index an empty matrix is always going to be an error.
I suspect that you meant to index i instead. Using variable names rather than single letters that have meaning would avoid you getting confused about which variable is which.
  1 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2019 年 1 月 31 日
Thanks Guillaume but after some thorough reading I indeed managed to solve it. Thanks again for your contribution.
May you can answer me this last comment?

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

その他の回答 (1 件)

Cris LaPierre
Cris LaPierre 2019 年 1 月 31 日
What you are describing is an App Designer app. Very possible there.
Perhaps a quicker way if you are using a live script is to add interactive controls. Right now (r18b) there are two options: slider and dropdown.
If you just want a dialog box to appear, my suggestion would be to look into the inputdlg function, which allows you to create a dialog box to gather user input(s).
  4 件のコメント
Cris LaPierre
Cris LaPierre 2019 年 1 月 31 日
The variable us does not contain the user inputs from the dialog box. Those are assigned to the variable U. The following lines of code appear to be unnecessary and can be removed.
t = cell2mat(us);
e = str2num(t);
Stelios Fanourakis
Stelios Fanourakis 2019 年 1 月 31 日
編集済み: madhan ravi 2019 年 1 月 31 日
Yes it's fixed that. Thank you very much. Can you please, check my new question and answer it ?

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

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by