# How to Display Data in Table

333 views (last 30 days)
Anthony Koning on 11 Dec 2021
Answered: Chunru on 12 Dec 2021
I wanted to ask how it would be possible to display the data of an exteriment into a table. For instance, If I am doing 11 trials, starting from 0 and rising to 50 in incraments of 5, how would I be able to display data in a table? I understand that it would be possible to format everything into an array and enter all values manually , but is it possible to display results directly as a table (for instance, if I wanted to up the trials from 11 to 100, so I wouldnt have to enter all values manually)
The code I'm working with is:
v = 0:5:50
a_n=(-0.01.*(v+50))./(exp(-(v+50)./10)-1)
b_n= exp(-(v+60)./80)./8
a_m = (-.1.*(v+35))./(exp(-(v+35)./10)-1)
b_m = 4.*exp(-(v+60)./18)
a_h = .07.*exp(-(v+60)./20)
b_h = 1./(exp(-(v+30)./10)+1)
but I want to display the results as a neatly organized table rather than a general output, especially if I want to change the start/endpoint or intervals.

Chunru on 12 Dec 2021
v = (0:5:50)'; % use a column here
a_n=(-0.01.*(v+50))./(exp(-(v+50)./10)-1);
b_n= exp(-(v+60)./80)./8;
a_m = (-.1.*(v+35))./(exp(-(v+35)./10)-1);
b_m = 4.*exp(-(v+60)./18);
a_h = .07.*exp(-(v+60)./20);
b_h = 1./(exp(-(v+30)./10)+1);
% For same size data here, you can organize them into a table
T = table(v, a_n, b_n, a_m, a_h, b_h)
T = 11×6 table
v a_n b_n a_m a_h b_h __ _______ ________ ______ __________ _______ 0 0.50339 0.059046 3.609 0.0034851 0.95257 5 0.55226 0.055468 4.0746 0.0027142 0.97069 10 0.60149 0.052108 4.5506 0.0021138 0.98201 15 0.65098 0.048951 5.0339 0.0016462 0.98901 20 0.70064 0.045985 5.5226 0.0012821 0.99331 25 0.75042 0.043199 6.0149 0.0009985 0.99593 30 0.80027 0.040582 6.5098 0.00077763 0.99753 35 0.85017 0.038123 7.0064 0.00060562 0.9985 40 0.90011 0.035813 7.5042 0.00047166 0.99909 45 0.95007 0.033643 8.0027 0.00036733 0.99945 50 1 0.031605 8.5017 0.00028607 0.99966
% if you want to show part of the data
T(4:7, :)
ans = 4×6 table
v a_n b_n a_m a_h b_h __ _______ ________ ______ __________ _______ 15 0.65098 0.048951 5.0339 0.0016462 0.98901 20 0.70064 0.045985 5.5226 0.0012821 0.99331 25 0.75042 0.043199 6.0149 0.0009985 0.99593 30 0.80027 0.040582 6.5098 0.00077763 0.99753

### Categories

Find more on Environment and Settings in Help Center and File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by