How do i reconstruct a matrix???
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
George
am 21 Jun. 2013
Beantwortet: George
am 14 Okt. 2013
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 Kommentare
Image Analyst
am 24 Jun. 2013
Bearbeitet: Image Analyst
am 24 Jun. 2013
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?
Akzeptierte Antwort
Andrei Bobrov
am 25 Jun. 2013
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
Weitere Antworten (2)
Evan
am 24 Jun. 2013
M(:,:,2) = flipud(M(:,:,2))
As an example:
M = rand(3,3,3); %random example 3d matrix
M(:,:,2) = flipud(M(:,:,2));
1 Kommentar
Evan
am 26 Jun. 2013
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
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!