APP DESIGNER EDIT FIELD ISSUE---HELP REQUESTED
4 ビュー (過去 30 日間)
古いコメントを表示
Hi,
Running 2024b:
I'm seeing a weird issue with Edit Field (numeric) values in App Designer. When I enter numbers, then try to confirm what the values are with the Test button, I get character symbols, rather than numbers in the command window. I can avoid this with Edit Field (Text)---but I can't for the life of me figure out why the numeric field entries aren't working. Similarly, I tried adding a spinner and displaying its value on a UI, but it is also corrupted. The numeric field shows the same odd behavior with a UI display as well.
I've attached the app.

1 件のコメント
採用された回答
Walter Roberson
2025 年 3 月 21 日
Your code has
disp(['EditField1.Value =' , app.EditField.Value]);
This does a horzcat() operation between a character vector and a numeric value. The [] operation between a character vector and a numeric value is defined as [CHARACTERVECTOR char(uint16(floor(NUMERICVALUE)))] . Which is to say that the numeric values are treated as unicode character positions and the corresponding characters are output.
[] between a character vector and a numeric value does not format the numeric value as printable characters.
You need one of
disp("EditField1.Value =" + app.EditField.Value);
or
disp(compose("EditField1.Value = %g", app.EditField.Value));
or
fprintf('EditField1.Value = %g\n', app.EditField.Value)
or
fprintf('EditField1.Value = %.999g\n', app.EditField.Value)
The first version will output the Value with no more than 4 numeric places after the decimal. The %g versions will output the Value with no more than 5 numeric places after the decimal. The version with %.999g will output the value with full and complete precision of value stored, such as 0.1000000000000000055511151231257827021181583404541015625 for 0.1
2 件のコメント
Image Analyst
2025 年 3 月 21 日
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
For full details on how to earn reputation points see: https://www.mathworks.com/matlabcentral/answers/help?s_tid=al_priv#reputation
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!