Hello. How can I change format of the some value in table function?

I want to display values with help of the table function under different format.

4 Commenti

jgg
jgg il 17 Dic 2015
Modificato: jgg il 17 Dic 2015
Does the command format not do what you want? Perhaps you could show us what you're trying to do, and what you currently are getting?
There my code:
format short e
T = table([1:i]',std_before(:,1),t_std(:,1),'VariableNames',...
{'num','std_before','std_after'})
getting result in such view:
num std_before std_after
__________ __________ __________
1.0000e+00 4.9202e-05 7.9809e-06
2.0000e+00 3.9159e-05 1.0550e-05
3.0000e+00 1.2294e-04 1.9551e-05
4.0000e+00 1.4849e-04 1.8173e-05
5.0000e+00 8.5471e-05 1.0604e-05
6.0000e+00 2.5667e-04 2.1527e-05
7.0000e+00 2.6500e-04 2.4409e-05
8.0000e+00 5.6494e-05 1.5062e-05
But I want num variable show as integer.
This:
format short e
is your problem. You've specifically said to NOT display anything as integers. Try using format short g instead.
but another way for set separate formats didn't described in the help

Accedi per commentare.

 Risposta accettata

Clear as mud. Different than what? Like one of the values in one of the table columns (say the 10th row) has 7 decimal places while all the other values in all the other rows have 4 decimal places or something like that??? You'll need to give an example. You might just have to use fprintf() and get exactly whatever peculiar formatting you want. You get the most flexibility with fprintf() because you have to specify absolutely everything.

1 Commento

Yes, you right. It was need to make columns in different formats (accuracy). But table function maybe can't adjusted for this. I decided use fprintf as you recomend. Thank you.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by