Normalized data to lookup table

לק"י
Hello!
I got a normalized vector which I want to make as an index for lookup table (preferablt in heatmap colors or blue colors).
Thanks!

1 件のコメント

dpb
dpb 2023 年 2 月 11 日
Well, you're going to have to gives us more background than that...show us an example of what you're trying to get from what it is you have...you might find <rescale> of interest, though.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 2 月 11 日

0 投票

There are a number of circumstances in which you can just use the normalized values as the data, and use a colormap(), and the value will automatically be converted into a color table index. See clim (caxis in older releases)
However if you need to do the mapping manually:
NumberOfEntriesInTable = size(YourColorTable,1);
mindata = min(YourData);
maxdata = max(YourData);
proportion = (YourData - mindata)./(maxdata - mindata);
table_idx = ceil(proportion * NumberOfEntriesInTable * (1-eps));
colored_data = YourColorTable(table_idx,:);
The output, colored_data,will be a numel(YourData) by 3 array, with Red, Green, and Blue columns.

カテゴリ

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

質問済み:

2023 年 2 月 11 日

回答済み:

2023 年 2 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by