How do I get a numerical value from Edit Text at a GUI and use it in same program?

30 views (last 30 days)
I'm trying to build a control interface for Lego Mindstorms using Matlab, but I need to read the power, given by the Text Edit box. How can I do that?

Accepted Answer

Walter Roberson
Walter Roberson on 25 Aug 2015
str2double(get(handles.editbox_5, 'String')) %replace editbox_5 with actual name of edit box
  3 Comments
Mohammed Hazim
Mohammed Hazim on 29 May 2022
That doesn't work!!!
Getting The following error:
Unable to resolve the name 'handles.width'.
Error in gui/ApplyButtonPushed (line 101)
val = str2double(get(handles.width, 'String')) %replace editbox_5 with actual name of edit box
Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)
newCallback = @(source, event)executeCallback(appdesigner.internal.service.AppManagementService.instance(), ...
Error while evaluating Button PrivateButtonPushedFcn.

Sign in to comment.

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!