필터 지우기
필터 지우기

replace comma to dot

조회 수: 15 (최근 30일)
Margareta Drozdikova
Margareta Drozdikova 2018년 3월 7일
편집: Stephen23 2018년 3월 7일
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

채택된 답변

Jan
Jan 2018년 3월 7일
편집: Jan 2018년 3월 7일
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
Margareta Drozdikova
Margareta Drozdikova 2018년 3월 7일
편집: Stephen23 2018년 3월 7일
Hi, thanks for help, it works really well. thanks again

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by