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.
댓글 수: 0
답변 (1개)
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
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 Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!