Cdata Help please i cant do it

3 ビュー (過去 30 日間)
Jules Ray
Jules Ray 2014 年 11 月 11 日
回答済み: Sean de Wolski 2014 年 11 月 11 日
Hi all, I am trying to display a typical grey 'Delete Row', Icon on the uitoolbar. (Programmatically) But I cant find the proper value of 'CData' to be assigned.
Maybe somebody knows how to find the appropriate 'CData' and create the icon using uipushtool. I'm using this example from matlab help:
the help provided is too short :
h = figure('ToolBar','none')
ht = uitoolbar(h)
a = [.20:.05:0.95];
b(:,:,1) = repmat(a,16,1)';
b(:,:,2) = repmat(a,16,1);
b(:,:,3) = repmat(flipdim(a,2),16,1);
hpt = uipushtool(ht,'CData',b,'TooltipString','Hello')

回答 (1 件)

Sean de Wolski
Sean de Wolski 2014 年 11 月 11 日
CData is just a small image, you can use any image and you can resize images if necessary with imresize in the Image Processing Toolbox.
For example:
I = imread('peppers.png');
Icon = imresize(I,[16 16])
h = figure('ToolBar','none')
ht = uitoolbar(h)
hpt = uipushtool(ht,'CData',Icon,'TooltipString','Hello')

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by