Filter löschen
Filter löschen

replace comma to dot

15 Ansichten (letzte 30 Tage)
Margareta Drozdikova
Margareta Drozdikova am 7 Mär. 2018
Bearbeitet: Stephen23 am 7 Mär. 2018
Hi, I have a small problem I have GUI, the user inputs a number in edit box, but problem is with decimal number. If user writes 10,5 instead of 10.5, the programm does not work, is there any option to convert , to . ? So the programm will run with comma in decimal numbers too thanks for help

Akzeptierte Antwort

Jan
Jan am 7 Mär. 2018
Bearbeitet: Jan am 7 Mär. 2018
Add this to the callback of the edit uicontrol:
function Edit1Callback(hObject, EventData, handles) % Or how it is called
Str = get(hObject, 'String');
Str = strrep(Str, ',', '.');
set(hObject, 'String', Str);
...
This replaces the comma by a dot at first.
  1 Kommentar
Margareta Drozdikova
Margareta Drozdikova am 7 Mär. 2018
Bearbeitet: Stephen23 am 7 Mär. 2018
Hi, thanks for help, it works really well. thanks again

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by