How to Avoid 1.0e+03 when read the readexcel data in matlab app designer ?
4 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!