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

Thread Subject:
Help needed with array..

Subject: Help needed with array..

From: si yeol Shin

Date: 1 Oct, 2010 07:44:08

Message: 1 of 2

i have a txt file like this....

1 20
1 21
1 30
2 4
2 29
3 28
3 40
3 1
3 4
4 43
4 10
4 4

and i wanna convert it like below.

20 4 28 43
21 29 40 10
30 1 4
              4
------------------------------------------------------------------------------------------------------------
what i want to say...
at first i divide the values of column 1.
1 2 3 4
1 2 3 4
1 3 4
          3
and then change the values as each follow values on column 2.
so the result is
20 4 28 43
21 29 40 10
30 1 4
              4
i wonder if you didn't understand what i mean....
because i'm no good at english... :(
plz.... anybody knows help me

Subject: Help needed with array..

From: Janis Doebler

Date: 7 Oct, 2010 11:35:06

Message: 2 of 2

Look up for "textscan", the number of colums in *.txt is known, to "read" the *.txt and creating a matrix. Then delete the first column (1,1,1,2,2,2,3,3,3,...) and then use reshape to make a 3xN matrix.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us