Remove zeros from a number

4 次查看(过去 30 天)
Hi,
I want to preform calculations with a number excluding the zeros. The number is entered in a textbox so it's totally random.
for example, the user enters 2000, so can I extract 2 from this? Or say user enters 100000, can I extract only the non zero digit?
Thanks,
Rana

采纳的回答

Image Analyst
Image Analyst 2020-6-4
编辑:Image Analyst 2020-6-4
Just get the edit box contents and set the 0's to nulls:
editBoxContents = handles.edit1.String;
editBoxContents(editBoxContents == '0') == []
If you want the number, just add
theNumber = str2double(editBoxContents);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by