Clear Filters
Clear Filters

having error on string for showing data on the app ui

1 view (last 30 days)
featuresTest = vertcat(featuresTest{:});
featuresTest = rmmissing(featuresTest);
featuresTest{:,2:15} = (featuresTest{:,2:15}-app.mn)./app.sd;
resulttable= app.HelperTestKNNClassifier(app.trainedClassifier, featuresTest);
app.MatchingPercentageEditField.Value=string(resulttable.ConfidencePercentage);
if str2double(string(resulttable.ConfidencePercentage))>70
app.StatusEditField.Value = "person authorized";
app.SpeakerIdentityEditField.Value=string(resulttable.PredictedSpeaker);
if string(resulttable.PredictedSpeaker) == "Jens_Stoltenberg"
elseif string(resulttable.PredictedSpeaker) == "Julia_Gillard"
elseif string(resulttable.PredictedSpeaker) == "Magaret_Tarcher"
elseif string(resulttable.PredictedSpeaker) == "Nelson_Mandela"
so whenever i run this code for my speech processing, I will have a problem showing the error "Error using matlab.ui.control.EditField/set.Value (line 99)
'Value' must be a character vector or a string scalar. "
on the line app.MatchingPercentageEditField.Value=string(resulttable.ConfidencePercentage);
any guru here that can help me, thanks !

Answers (1)

dpb
dpb on 18 Jan 2023
Moved: dpb on 18 Jan 2023
Per <uieditfield> documentation,
Value Text in edit field
'' (default) | character vector | string scalar
Text in the edit field, specified as a character vector or string scalar. MATLAB® displays the text as a single line. If you want to allow multiple lines of text, use a text area component instead of an edit field.
Your .ConfidencePercentage table variable is a vector of values, not a single value.
Do you really want the user to be able to modify these or just display them? Either way, the uieditfield component can't display but a single string.
  4 Comments
Kiat Tsen Lim
Kiat Tsen Lim on 19 Jan 2023
so if I use a text area component, do i still need to put string before (resulttable.confidencepercentage)?
For example:
app.MatchingPercentageEditField.Value=string(resulttable.ConfidencePercentage);
dpb
dpb on 19 Jan 2023
The .Value property is text, yes...but the uitable can handle the table directly with variable names, etc., etc., ... Don't know your application, of course, but from afar would seem to be a good choice

Sign in to comment.

Categories

Find more on Sudoku in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!