Zdata(N,1) to RGB Cdata(N,1,1:3)

1 回表示 (過去 30 日間)
Arthur Allen
Arthur Allen 2013 年 3 月 19 日
I have lat, long, and skill vectors. All vectors are (n,1). (skill ranges from 0.0 to 1.0)
for j = 1:n_validlength;
plotm(Lat_NCOMwCodar(j),Lon_NCOMwCodar(j),0,'Marker','s','MarkerSize',12,...
'MarkerFaceColor',skill_color_NCOMatCodar(j,jj,:));
end
where skill_color_NCOMatCodar(j,jj,1:3) is colormap('jet') from skill_NCOMatCodar(j,jj)
How to set the relationship between SKILL(n,jj) range 0.0 to 1.0 to SKILL_COLOR(n,jj,1:3) ?
I can not use contourm, geoshowm, because data is not at i,j mesh, image. Ilregular grids are used.

採用された回答

Arthur Allen
Arthur Allen 2013 年 3 月 19 日
Solved my own question:
cmap_jet = colormap(jet(64)); % used colormap 'jet' with 64 colors
for j = 1:n
if skill(j) == 0;
skill_color(j,:) = ([0 0 0]); % set to black
else
% return index from 1 to 64 based upon skill level (data) from 0.0 to 1.0
% note: skill.*number_of_colors_in_colormap
% note: goal: return indexes from 1 to 64 starting with data range.
skill_color_idx(j) = uint8(ceil(skill(j).*64));
% now return cmap_jet row :RGB as color of skill
skill_color(j,:) = cmap_jet(skill_color_idx(j),:); % jet colors
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by