How to have a user prompt window to submit real time values
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Stelios Fanourakis
le 31 Jan 2019
Modifié(e) : madhan ravi
le 31 Jan 2019
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
0 commentaires
Réponse acceptée
Guillaume
le 31 Jan 2019
Modifié(e) : Guillaume
le 31 Jan 2019
@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.
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.
Plus de réponses (1)
Cris LaPierre
le 31 Jan 2019
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 commentaires
Cris LaPierre
le 31 Jan 2019
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);
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!