I am trying to take the user input and put it in a vector I tried this following code but this is what I get :Unable to resolve the name handles.ValeurdeXEditField.String.
1 次查看(过去 30 天)
显示 更早的评论
% Button pushed function: CalculerButton
function CalculerButtonPushed(app, event)
s = handles.ValeurdeXEditField.String;
try
d = str2double(strsplit(s{:}, ','));
catch
error('Edit field must contain comma separated values such as "6, 5, 3.14"')
end
end
end
0 个评论
回答(1 个)
Voss
2022-5-17
Maybe handles should be app?
2 个评论
Voss
2022-5-18
If you want to get an array of numbers from an EditField, try this:
x = str2num(app.ValeurdeXEditField.Value);
(You don't need to try to parse the array yourself, e.g., by using strsplit. In fact, the lines you have with strsplit will always throw an error when you try to do x{:} or s{:} because x and s are not cell arrays.)
If you want to get a single scalar number from a NumericEditField, try this:
x = app.ValeurdeXEditField.Value;
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!