How to Display Data in Table (2024)

723 views (last 30 days)

Show older comments

Anthony Koning on 11 Dec 2021

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table

Commented: Chunru on 4 Dec 2023

Accepted Answer: Chunru

Open in MATLAB Online

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)

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.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Chunru on 12 Dec 2021

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table#answer_853165

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table#answer_853165

Edited: Chunru on 4 Dec 2023

Open in MATLAB Online

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

% To display table with specific format:

% Round it and save to a new variable

T1 = varfun(@(x)(round(x, 2)), T)

T1 = 11×6 table

Fun_v Fun_a_n Fun_b_n Fun_a_m Fun_a_h Fun_b_h _____ _______ _______ _______ _______ _______ 0 0.5 0.06 3.61 0 0.95 5 0.55 0.06 4.07 0 0.97 10 0.6 0.05 4.55 0 0.98 15 0.65 0.05 5.03 0 0.99 20 0.7 0.05 5.52 0 0.99 25 0.75 0.04 6.01 0 1 30 0.8 0.04 6.51 0 1 35 0.85 0.04 7.01 0 1 40 0.9 0.04 7.5 0 1 45 0.95 0.03 8 0 1 50 1 0.03 8.5 0 1

2 Comments

Show NoneHide None

Shreen El-Sapa on 3 Dec 2023

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table#comment_2985189

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table#comment_2985189

to reduce dicemal to 2 dgits or 3, what can I do?

Chunru on 4 Dec 2023

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table#comment_2985654

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/1609075-how-to-display-data-in-table#comment_2985654

See above.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

See Also

Categories

MATLABLanguage FundamentalsData TypesTables

Find more on Tables in Help Center and File Exchange

Tags

  • display results as table

Products

  • MATLAB

Release

R2021a

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


How to Display Data in Table (5)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

How to Display Data in Table (2024)
Top Articles
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 5778

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.