How to sort all the columns of a file into a single column?

1 view (last 30 days)
I have a data file having several columns of values. I want to sort all the columns of the file into one column. For example let us assume the data has only two columns like
1 5
2 6
3 7
4 8
I want to sort this data like
1
2
3
4
5
6
7
8
This is just an example with two columns. My original data has several columns. In that case how can I sort all the columns into a single column?

Accepted Answer

Carlos
Carlos on 23 Apr 2014
Try
reshape(A,numel(A),1)
  2 Comments
Carlos
Carlos on 23 Apr 2014
try dlmread or try
A = load('Filename.txt', '-ascii');

Sign in to comment.

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 23 Apr 2014
out=sort(A(:))

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!