No bool matrices for imagesc in tip?

Søren Hauberg soren at hauberg.org
Sat Nov 1 16:59:13 CDT 2008


lør, 01 11 2008 kl. 21:51 +0000, skrev Michael Goffioul:
> On Sat, Nov 1, 2008 at 7:15 PM, Thomas Weber
> <thomas.weber.mail at gmail.com> wrote:
> > Am Samstag, den 01.11.2008, 10:14 +0000 schrieb Michael Goffioul:
> >> My question was badly expressed. It should have been: does
> >> Matlab accepts that you "set(img, 'cdata', m)", where img is
> >> an image handle and m is a bool matrix?
> >
> >>> m = ones(10,10)>0;
> >>> img = figure()
> >>> set(img, 'cdata', m)
> > ??? There is no 'cdata' property in the 'figure' class.
> 
> Indeed. As I mentioned, img should be an image handle, not
> a figure handle.

The following code

  f = imshow (rand (50));
  m = ones(50)>0;   
  set(f, 'cdata', m) 

works just fine, and the resulting figure is a white image. Also,

  get (f)

prints

        AlphaData = [1]
        AlphaDataMapping = none
        Annotation = [ (1 by 1) hg.Annotation array]
        CData = [ (50 by 50) logical array]
        CDataMapping = scaled
        DisplayName = 
        EraseMode = normal
        XData = [1 50]
        YData = [1 50]

        BeingDeleted = off
        ButtonDownFcn = 
        Children = []
        Clipping = on
        CreateFcn = 
        DeleteFcn = 
        BusyAction = cancel
        HandleVisibility = on
        HitTest = on
        Interruptible = off
        Parent = [171.001]
        Selected = off
        SelectionHighlight = on
        Tag = 
        Type = image
        UIContextMenu = []
        UserData = []
        Visible = on

Søren



More information about the Octave-maintainers mailing list