How to Avoid 1.0e+03 when read the readexcel data in matlab app designer ?

4 ビュー (過去 30 日間)
Anup Patil
Anup Patil 2023 年 10 月 5 日
編集済み: dpb 2023 年 10 月 5 日
Hi
I have created an application where i want to upload excel data, in numerical data e.g. if in excel 0.000000000002 value is there in UITable it is showing up to 0.0000 and when i print that it showing 2.000000000000000e-12 , How to avoid this , I need to display this in UITable as it is 0.000000000002 and print as it is 0.000000000002

採用された回答

dpb
dpb 2023 年 10 月 5 日
編集済み: dpb 2023 年 10 月 5 日
Formatting numeric values in the uitable is limited -- the only way you will be able to do this will be to convert to a string with the desired format and then display the string -- which means you'll have to convert it back and forth both ways--to a string to display and then back to number to use if changed or read the cell .Data value.
And, if you use a MATLAB table to display then you can't use the .Format property, rules are different for that case...it then will display the data in the same way as the command window does -- so the table column would have to be converted to character strings with the same issues in using it.
Try the below at command line, to illustrate
hUF=uifigure();
V=2E-12;
hUIT=uitable(hUF,'Data',V,'ColumnWidth',{120});
pause(5)
hUIT.Data=compose('%0.12f',V);
hUIT.ColumnWidth={140};
The problem here then will be what if the number next time is 2.3E-12? Then you'll have to have '%0.13f' to display the significant digits and the complications grow...

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by