Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How do I places separate columns next to each other to create a table?

Asked by Surush on 11 Mar 2014
Latest activity Answered by Salaheddin Hosseinzadeh on 11 Mar 2014

I have the following columns:

A = 
       1
       2
       3
       4
       5
       6
B = 
       7
       8
       9
      10
      11
      12
C = 
      13
      14
      15
      16
      17
      18

But I want to create a table of these separate columns so that it looks something like this:

TABLE =
      1     7    13
      2     8    14
      3     9    15
      4    10    16
      5    11    17
      6    12    18

Any suggestions on how I could do this?

Many thanks in advance.

0 Comments

Surush

Products

No products are associated with this question.

1 Answer

Answer by Salaheddin Hosseinzadeh on 11 Mar 2014

It's very easy actually! you can eaither use this code

TABLE= [A,B,C]

or you can use concatenate commands, either ways are the same! Refer to MATLAB help for commands below. And don't forget that your matrices should of the same coloumn or row for each instance!

vertcat
horzcat

Good luck!

0 Comments

Salaheddin Hosseinzadeh

Contact us