can anyone tell me how to create table in matlab?

please help me to create table using matlab

1 Comment

@Pooja Prajapati: did you try reading the MATLAB documentation? It shows several ways to create tables, and gives lots of examples:

Sign in to comment.

Answers (1)

Iddo Weiner
Iddo Weiner on 1 Feb 2017
Edited: Steven Lord on 1 Feb 2017
There's great documentation for these kinds of stuff (this is one of the virtues of MATLAB):
[SL: Edited to correct the usage of the name MATLAB not to use the possessive and to fix a typo.]

5 Comments

all these are ok,
But my question here is how can i give that table a specific name?
as in all these example it's all given about it's that table's all column,how to insert data n all.
but i can't get idea about how to give table name?
@Pooja Prajapati: what do you mean? How should the table have a name? If you want to know how to name the variable that the table is assigned to, then simply do this:
yourVariableNameHere = array2table(...)
If that is not what you mean, then please explain exactly how you think your table should have a name: where would this be visible?
when i am trying to create table like this as shown in example of above link,
It fails,
I am getting error in this,
See my code & error,
T = table(speakerid,name)
Undefined function or variable 'speakerid'.
And what i mean to ask,that jst lk in sql when we are trying to create table,
We write syntax lk this,
Create table (tablename)
so same in that way,
What to do in matlab to create table name.?
Notice that the syntax is different than in SQL: in your example what you're actually doing is calling your table "T", and telling it take variables called "speakerid" and "name" and store them in the table. You're getting an error becasue you haven't defined these variables.
Here's a simple usage example (although, really, these things are extremely well documented so check out the link I put at the beginning of this answer):
A = [1:3]';
B = {'A';'B';'C'};
my_table = table(A,B)
here's what you get:
my_table =
A B
_ ___
1 'A'
2 'B'
3 'C'
Hello,
thanks for the code. How to change the columns and rows colors?
Venkat

Sign in to comment.

Categories

Asked:

on 1 Feb 2017

Commented:

on 3 Jan 2019

Community Treasure Hunt

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

Start Hunting!