How do i reconstruct a matrix???

I have a matrix 2000x3 like this:
1 1 6
1 2 8
1 3 15
....
2 1 10
2 2 20
2 3 13
....
3 1 12
3 2 18
3 3 14
...
...
and i want to reconstruct like this:
1 1 6
1 2 8
1 3 15
....
2 3 13
2 2 20
2 1 10
....
3 1 12
3 2 18
3 3 14
...
...
Please help me..

3 件のコメント

Matt J
Matt J 2013 年 6 月 24 日
I see no difference between the data before and the data after (apart from order).
Image Analyst
Image Analyst 2013 年 6 月 24 日
編集済み: Image Analyst 2013 年 6 月 24 日
The middle group has the second column flipped. But that's not enough to figure out what needs to be done in general. And what does this have to do with Image Processing, like the tag says?
George
George 2013 年 6 月 25 日
編集済み: George 2013 年 6 月 25 日
i tag this question with ''image processing'' because these data come from grayscale image. What i want to do on my matrix is when the first column has an odd number the second and third column stay the same, when i have an even number the second and the third column reverse in order from bottom to top.

サインインしてコメントする。

 採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 6 月 25 日

0 投票

a - your array
a1 = a;
n = unique(a(:,1));
for jj = 1:numel(n)
if rem(n(jj),2) == 0
t = a1(:,1) == n(jj);
a1(t,:) = flipud(a1(t,:));
end
end

1 件のコメント

George
George 2013 年 6 月 25 日
Thank you Andrei!!!

サインインしてコメントする。

その他の回答 (2 件)

Evan
Evan 2013 年 6 月 24 日

0 投票

M(:,:,2) = flipud(M(:,:,2))
As an example:
M = rand(3,3,3); %random example 3d matrix
M(:,:,2) = flipud(M(:,:,2));

1 件のコメント

Evan
Evan 2013 年 6 月 26 日
In light of George's update in the below comment, this code does not do what he is asking for. http://www.mathworks.com/matlabcentral/answers/79846#comment_156778

サインインしてコメントする。

George
George 2013 年 10 月 14 日

0 投票

i write this matrix to a .txt file and i would like to numerate the lines, for example :
1 1 1 6
2 1 2 8
3 1 3 15
....
50 2 1 10
51 2 2 20
52 2 3 13
....
Please will someone help me?

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

2013 年 6 月 21 日

回答済み:

2013 年 10 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by