Returning error that there is not

조회 수: 6 (최근 30일)
Marco
Marco 2012년 12월 20일
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
Walter Roberson
Walter Roberson 2012년 12월 21일
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 2012년 12월 21일
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 ?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2012년 12월 21일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by