Table is not displaying cell arrays
Show older comments
I had a question because I was doing the tutorial on http://www.mathworks.com/help/matlab/ref/polyfit.html and their table displayed everything in coloumns, but mine just stayed as cell arrays. How do I display them like in the tutorial?
I get this:
X Y YPrime YDiffierence
_____________ _____________ _____________ _____________
[1x10 double] [1x10 double] [1x10 double] [1x10 double]
I want something like this:
X Y Fit FitError
___ _______ __________ ___________
0 0 0.00044117 -0.00044117
0.1 0.11246 0.11185 0.00060836
0.2 0.2227 0.22231 0.00039189
0.3 0.32863 0.32872 -9.7429e-05
0.4 0.42839 0.4288 -0.00040661
0.5 0.5205 0.52093 -0.00042568
0.6 0.60386 0.60408 -0.00022824
0.7 0.6778 0.67775 4.6383e-05
0.8 0.7421 0.74183 0.00026992
0.9 0.79691 0.79654 0.00036515
1 0.8427 0.84238 0.0003164
1.1 0.88021 0.88005 0.00015948
1.2 0.91031 0.91035 -3.9919e-05
1.3 0.93401 0.93422 -0.000211
1.4 0.95229 0.95258 -0.00029933
1.5 0.96611 0.96639 -0.00028097
1.6 0.97635 0.97652 -0.00016704
1.7 0.98379 0.98379 8.3306e-07
1.8 0.98909 0.98893 0.00016278
1.9 0.99279 0.99253 0.00025791
2 0.99532 0.99508 0.00024347
2.1 0.99702 0.99691 0.0001131
2.2 0.99814 0.99823 -8.8548e-05
2.3 0.99886 0.99911 -0.00025673
2.4 0.99931 0.99954 -0.00022451
2.5 0.99959 0.99936 0.00023151
Thank you.
Answers (1)
Azzi Abdelmalek
on 29 Apr 2016
Just use the example of the link
x = (0:0.1:2.5)';
y = erf(x)
p = polyfit(x,y,6)
f = polyval(p,x);
T = table(x,y,f,y-f,'VariableNames',{'X','Y','Fit','FitError'})
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!