[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: No bool matrices for imagesc in tip?
From: |
John W. Eaton |
Subject: |
Re: No bool matrices for imagesc in tip? |
Date: |
Fri, 31 Oct 2008 12:38:14 -0400 |
On 31-Oct-2008, David Bateman wrote:
| Thomas Weber wrote:
| > Hi,
| >
| > consider the following:
| >
| > imagesc(ones(10,10)>0)
| >
| > This works in 3.0.1, but fails in current tip (8487:dc62132651db) with
| >
| > imagesc(ones(10,10)>0)
| > error: invalid value for array property "cdata"
| > error: set: expecting argument 2 to be a property name
| > error: set: expecting argument 4 to be a property name
| > error: set: expecting argument 6 to be a property name
| > error: called from:
| > error:
/home/weber/sources/vcs/mercurial/octave-build/scripts/image/__img__.m at line
60, column 7
| > error:
/home/weber/sources/vcs/mercurial/octave-build/scripts/image/image.m at line
78, column 5
| > error:
/home/weber/sources/vcs/mercurial/octave-build/scripts/image/imagesc.m at line
114, column 7
| > error:
/home/weber/sources/vcs/mercurial/octave-build/scripts/image/imagesc.m at line
63, column 9
| > error: A(I): Index exceeds matrix dimension.
| > error: called from:
| > error:
/home/weber/sources/vcs/mercurial/octave-build/scripts/plot/__go_draw_axes__.m
at line 334, column 22
| > error:
/home/weber/sources/vcs/mercurial/octave-build/scripts/plot/__go_draw_figure__.m
at line 58, column 8
| > error:
/home/weber/sources/vcs/mercurial/octave-build/scripts/plot/gnuplot_drawnow.m
at line 66, column 5
| >
| >
| > Casting the bool matrix to double works around this, but is this expected?
| >
| > Thomas
| >
| >
| >
| The line concerned is
|
| tmp = __go_image__ (ca, "cdata", img, "xdata", xlim, "ydata", ylim,
| "cdatamapping", "direct", varargin {:});
|
|
| and as img is a logical array then cdata is set from it. The next part
| of the issue is that in graphics.h.in in the image class there is the code
|
|
| void init (void)
| {
| xdata.add_constraint (2);
| ydata.add_constraint (2);
| cdata.add_constraint ("double");
| cdata.add_constraint ("uint8");
| cdata.add_constraint (dim_vector (-1, -1));
| cdata.add_constraint (dim_vector (-1, -1, 3));
| }
|
| and so cdata is required to be either a double or an uint8 array. Does
| adding the line
|
| cdata.add_constraint("logical");
|
| help?
Yes, that seems to fix the problem. Will you please check in this
fix?
Thanks,
jwe