Matlab App Designer displays an array of numbers when the variable in question is a double
10 ビュー (過去 30 日間)
古いコメントを表示
I am having trouble displaying a single value in App Designer. I have tried the following code in a .m file and in the command window with no issues, but when implemented into App Designer Matlab outputs an array of numbers:
acc_max = (acceleration(Ifmax1+Acc_start_ind)); % Point of maximum acceleration
F = app.EditField.Value*acc_max; % Edit field provides mass of object to calculate force
APrime = num2str(round(F,1));
app.Label_4.Text = (APrime);
This code performs as expected when "F = app.EditField.Value" as well as "F = acc_max", however when they are multiplied together (as seen above) and then converted to a string I receive multiple numbers well below the expected output. I have used this approach with success in editing other label text, but I cannot seem to work this instance. The received output is given below
0 件のコメント
採用された回答
Steven Lord
2022 年 6 月 23 日
Instead of using an EditField (whose Value property is the text the user entered in the field according to the documentation) you probably want to use a NumericEditField (whose Value property is the number the user entered in the field, again according to the documentation.)
a = '12345'; % EditField's Value
b = a*2
c = 12345; % NumericEditField's Value
d = c*2
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!