Returning error that there is not

2 Ansichten (letzte 30 Tage)
Marco
Marco am 20 Dez. 2012
Hi,
I made this function
function [out] = pardin(N,T)
that contains a figure handle as structure with other handles; some of these are generated from for loop 'cause their position properties in figure are loop-depending;
So, if I edit this function and turn it in a simple m-file (providing variables called N and T, of course) it works, but if use it as above (as a function) it returns me this error:
Error using uitable
Width and height must be > 0
Error in uitable (line 52)
thandle = builtin('uitable', varargin{:});
Error in pardin (line 43)
S.w(jj,1) = uitable('Parent', S.fig, 'Data', A(:,:,jj), 'Units', 'normalized', 'Position', [0.7
1-((jj+jj+0.09)*0.1) 0.26 0.15 ]);
I think this is the error that it should return if 'Position' vector has 3rd and 4th element not positive, but my S.w handle, as you can observe, has those positive elements. How is it possible ? I tried to delete this handle and it returns same error for the other handles. As I wrote, if I use it as m-file script it works
  4 Kommentare
Walter Roberson
Walter Roberson am 21 Dez. 2012
I was working on the hypothesis that jj might have a value that caused the Y to be out of range and the wrong error being returned.
Okay, with the same breakpoint in place, run until error, and then at the uitable level, please show us
varargin{:}
Marco
Marco am 21 Dez. 2012
So, I do it:
varargin{:} has these elements:
varargin =
'Parent' [2] 'Data' {4x4 cell} 'Units' 'normalized' 'Position' [1x4 int8]
where if I type:
K>> varargin(8)
it returns:
ans =
[1x4 int8]
so
K>> ans{:,:}
ans =
1 1 0 0
why are they zeros ?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 21 Dez. 2012
The datatype of your variable "jj" is int8, and that is causing the Position calculation to be carried out in int8. That is resulting in the floating point values being rounded to integers, and [1 1 0 0] is the result.
Is there a particular reason you used int8 for that datatype? If not then just let jj be double. But if you need to, use
[0.7 1-((double(jj)+double(jj)+0.09)*0.1) 0.26 0.15 ]
Note that double(jj+jj) would be different than double(jj)+double(jj) if jj was 128 or larger.

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by