Converting comma to dot in app designer

Hi, i'm trying to convert a number with comma to number with dot, like "0,25" to "0.25"
In the past i used in GUIDE the follow structure and always worked just fine:
function calcular_cc_geradorButtonPushed(app, event)
escolha_lista_curto = app.escolha_curto.Value
X1_pu = str2double(strrep(app.Z_x1.Value,',','.'));
if strcmp(escolha_lista_curto,'Ex: 1Ø')
app.z_base.Value=X1_pu;
end
end
But now, i'm always getting the same error:
'Value' must be a double scalar within the range of 'Limits'.
What should i do?
Thanks

6 件のコメント

Stephen23
Stephen23 2019 年 5 月 4 日
@Jucimar Carpe: please show us the complete error message. This means all of the red text.
Jucimar Carpe
Jucimar Carpe 2019 年 5 月 4 日
Hi Stephen, sorry...my mistake.
Here is the complete error message:
----------
Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 184)
'Value' must be a double scalar within the range of 'Limits'.
-----
Just for your information, first of all, i'm testing inserting a number with comma in a box and then converting to a number with dot to be displayed in another box. In the future i'wont dsplay numbers with comma, just with dot. So this is like a test if matlab is converting in the right way to let me proceed with maths.
Stephen23
Stephen23 2019 年 5 月 4 日
What is the value of X1_pu ?
Jucimar Carpe
Jucimar Carpe 2019 年 5 月 4 日
0.2 but want to have the possibility to enter 0,2 as well.
Walter Roberson
Walter Roberson 2019 年 5 月 5 日
If X1_pu is coming out as double and scalar, then the implication is that Limits is the problem.
Jucimar Carpe
Jucimar Carpe 2019 年 5 月 5 日
Yah, thats true.
But the questoin is: Is it possible to converto from comma to dot?
Or in the worst scenario, it it possible to create a pop window to inform the user that it must enter a number with dot?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

リリース

R2018a

質問済み:

2019 年 5 月 4 日

コメント済み:

2019 年 5 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by