palette and index changes

Palette=
0
1
2
3
4
5
6
7
Swapping is done in palette
k=1 2 3 4 5 6 7 8
l=4 8 1 1 1 1 4 4
This is the to swap the position
This is my changed Palette
3
7
0
0
0
0
3
3
This palette changes my index matrix also.. index matrix 2185x1575
for example 0 will be replaced by 3 and 3 to 0
Palette affect the index matix also
Pls anyone help me

8 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 25 日
編集済み: Azzi Abdelmalek 2013 年 10 月 25 日
How did you get the changed palette for the above example?
Anusha
Anusha 2013 年 10 月 25 日
編集済み: Anusha 2013 年 10 月 25 日
Using k and l matrix 1 is replaced by 3
2 to 8
3 10 1 like this
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 25 日
2 to 8 where?
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 25 日
Post the expected result for 2 iterations
Anusha
Anusha 2013 年 10 月 25 日
I edit my changed palette...please see
Anusha
Anusha 2013 年 10 月 25 日
This is my index matrix C=
1 2 5 4 4 4 4 3 3 3
2 2 2 3 3 3 3 5 5 1
0 0 0 7 7 7 6 6 5 5
1 1 1 5 7 6 5 5 4 4
what are the values are changed in my palette is also changed my index matrix sir...
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 25 日
You can't get three 0
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 25 日
How your C matrix is affected? Please to make your question clear, edit your question, don't just add a comment. And you can also post the expected result for
k=1
l=4
The new Palette and the new C
We are not supposed to guess what is in your mind

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

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 25 日

0 投票

Palette=0:8;
idx=1:numel(Palette);
k=[1 2 3 4 5 6 7 8];
l=[4 8 1 1 1 1 4 4];
for ii=1:numel(k)
a=Palette(k(ii));
Palette(k(ii))=Palette(k(ii));
Palette(l(ii))=a;
i1=idx(k(ii));
idx(k(ii))=idx(l(ii));
idx(l(ii))=i1;
end
disp(idx)
disp(Palette)

1 件のコメント

Anusha
Anusha 2013 年 10 月 25 日
編集済み: Anusha 2013 年 10 月 25 日
index matrix I=
2 6 6 0 0 3 3 3
4 4 4 2 2 2 1 1
5 5 3 3 0 0 4 4
Palette P=
0
1
2
3
4
5
6
P will be changed(swapping, is depend on the position)
P=
6
0
3
4
2
5
1
What is the code to view this ans
What are the values chaged in P It will changes the index matrix
ans=
I=
3 1 1 6 6 4 4 4
2 2 2 3 3 3 0 0
5 5 4 4 6 6 2 2

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

カテゴリ

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

質問済み:

2013 年 10 月 25 日

コメント済み:

2013 年 10 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by