Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Kaustubha Govind
Kaustubha Govind il 22 Giu 2011
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 Commenti
partha das
partha das il 22 Giu 2011
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 il 22 Giu 2011
"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.

Accedi per commentare.

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by