필터 지우기
필터 지우기

showing the error' ??? Object belongs to an incompatible Java class. Error in ==> try2 at 7 set(t,'Data', eg1);'

조회 수: 1 (최근 30일)
i was trying to get an matrix out put in matlab7.5 using the prog
eg=[1 2 3 4] %[m,n]= size(eg);
f = figure('Position', [100 100 752 350]); t = uitable('Parent', f, 'Position', [100 100 700 200]); eg1= num2cell(eg); set(t,'Data', eg1);
it is showing the error ??? Object belongs to an incompatible Java class.
Error in ==> try2 at 7 set(t,'Data', eg1); but it showing every matrix of order m*n, but showing the error in case of matrix of order 1*n or m*1. please help me so that i can get the matrix of order m*1. thank you in advanced.

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2011년 6월 22일
I'm not sure if UITABLE was documented/supported fully in MATLAB 7.5 - I am able to run your code without any errors on MATLAB 7.12 (R2011a).
For MATLAB 7.5, you could try converting your data to a Java object array and then set it on the uitable's Data:
egJ = javaArray('java.lang.Object', 1,4) ;
for m = 1:length(eg)
egJ(1,m) = java.lang.Double(eg(m));
end
set(t, 'Data', egJ);
  댓글 수: 2
partha das
partha das 2011년 6월 22일
if UITABLE is not supported in matlab then why it is showing results for any m*n matrix excluding 1*n or m*1 matrix???
please reply
Walter Roberson
Walter Roberson 2011년 6월 22일
"unsupported" can mean that it exists but is not promised to work for any given case. You got lucky that it worked at all for you.

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by