How to Avoid 1.0e+03 when read the readexcel data in matlab app designer ?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
dpb
am 5 Okt. 2023
Bearbeitet: dpb
am 5 Okt. 2023
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!