Thread Subject: uitable on cell array containing strings

Subject: uitable on cell array containing strings

From: Stephane Carlier

Date: 4 Dec, 2007 19:32:36

Message: 1 of 7

Recently I have great frustration using the "undocumented"
uitable functionality. Although it works fine with numerical
matrix, it doesn't work with cell array, e.g.,

Matlab command
t = uitable({'a', 'b'}, {'col_1', 'col_2'})
behaves as expected. It creates a table with 2 columns and
two table entries.

However, subsequently:
set(t, 'Data', {'c', 'd'})
generates an error: "??? Object belongs to an incompatible
Java class."

Could someone shine some light on this? Thank you,

Subject: uitable on cell array containing strings

From: Stephane Carlier

Date: 4 Dec, 2007 19:53:20

Message: 2 of 7

Well, I figured out myself. Remembering what Yair said last
time, I dig into the code, and found that I have to use
"t.setData()" instead of "set" to update the table content.

"Stephane Carlier" <youfellow@hotmail.com> wrote in message
<fj4a0k$1v$1@fred.mathworks.com>...
> Recently I have great frustration using the "undocumented"
> uitable functionality. Although it works fine with numerical
> matrix, it doesn't work with cell array, e.g.,
>
> Matlab command
> t = uitable({'a', 'b'}, {'col_1', 'col_2'})
> behaves as expected. It creates a table with 2 columns and
> two table entries.
>
> However, subsequently:
> set(t, 'Data', {'c', 'd'})
> generates an error: "??? Object belongs to an incompatible
> Java class."
>
> Could someone shine some light on this? Thank you,

Subject: uitable on cell array containing strings

From: Stuart McGarrity

Date: 4 Dec, 2007 23:44:28

Message: 3 of 7

This undocumented feature is very difficult to use and its interface will
probably change soon when it becomes documented. function. You get an error
because t is a java handle and not a regular HG handle.

Try this:
>>t = uitable({'a', 'b'}, {'col_1', 'col_2'})
>>t.setData({'c', 'd'})

You can look at some usage examples in this application:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=16075&objectType=FILE

Stuart

"Stephane Carlier" <youfellow@hotmail.com> wrote in message
news:fj4a0k$1v$1@fred.mathworks.com...
> Recently I have great frustration using the "undocumented"
> uitable functionality. Although it works fine with numerical
> matrix, it doesn't work with cell array, e.g.,
>
> Matlab command
> t = uitable({'a', 'b'}, {'col_1', 'col_2'})
> behaves as expected. It creates a table with 2 columns and
> two table entries.
>
> However, subsequently:
> set(t, 'Data', {'c', 'd'})
> generates an error: "??? Object belongs to an incompatible
> Java class."
>
> Could someone shine some light on this? Thank you,

Subject: uitable on cell array containing strings

From: Stephane Carlier

Date: 5 Dec, 2007 15:30:04

Message: 4 of 7

Stuart,

Thank you very much! That helps a lot. I can't wait for the
"documented" uitable because I have to finish the GUI fast
(after all, that's why people use Matlab in the first
place). I just wish them put the feature in asap.

Subject: uitable on cell array containing strings

From: Yair Altman

Date: 2 Feb, 2008 16:40:04

Message: 5 of 7

"Stephane Carlier" <youfellow@hotmail.com> wrote in message
<fj6g5s$svh$1@fred.mathworks.com>...
> Stuart,
>
> Thank you very much! That helps a lot. I can't wait for the
> "documented" uitable because I have to finish the GUI fast
> (after all, that's why people use Matlab in the first
> place). I just wish them put the feature in asap.
 
uitable becomes documented in the upcoming Matlab version
(R2008a, aka 7.6), at least in the beta version. I have
still not investigated the degree to which it became
documented with respect to the underlying Java functionality.
 
Yair Altman
http://ymasoftware.com

Subject: uitable on cell array containing strings

From: Thierry

Date: 21 Feb, 2008 13:49:02

Message: 6 of 7

"Stuart McGarrity" <stuartm@mathworks.com> wrote in message
<fj4oos$bq8$1@fred.mathworks.com>...
> This undocumented feature is very difficult to use and its
interface will
> probably change soon when it becomes documented. function.
You get an error
> because t is a java handle and not a regular HG handle.
>
> Try this:
> >>t = uitable({'a', 'b'}, {'col_1', 'col_2'})
> >>t.setData({'c', 'd'})
>
> You can look at some usage examples in this application:
>
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=16075&objectType=FILE
>
> Stuart
>
> "Stephane Carlier" <youfellow@hotmail.com> wrote in message
> news:fj4a0k$1v$1@fred.mathworks.com...
> > Recently I have great frustration using the "undocumented"
> > uitable functionality. Although it works fine with numerical
> > matrix, it doesn't work with cell array, e.g.,
> >
> > Matlab command
> > t = uitable({'a', 'b'}, {'col_1', 'col_2'})
> > behaves as expected. It creates a table with 2 columns and
> > two table entries.
> >
> > However, subsequently:
> > set(t, 'Data', {'c', 'd'})
> > generates an error: "??? Object belongs to an incompatible
> > Java class."
> >
> > Could someone shine some light on this? Thank you,
>
>


Hello,
i try to update a uitable which contains a basic matrix of
numbers. How can i do it (using the setData i suppose)?
typically, my table t contains matrix Datatable, and i want
to update the table with a new matrix Datatable_updated.
the basic command t.setData(Datable_updated) doesn't work.
What is the syntax when you want to update a table?
thanks

Subject: uitable on cell array containing strings

From: Ronnie

Date: 9 Jul, 2009 21:45:18

Message: 7 of 7

Thierry,

Did you find a solution to this problem? I have the same issue trying to set an array. I can not upgrade to take advantage of the documented version due to project requirements.

Ronnie

"Thierry " <titibondat@hotmail.com> wrote in message <fpjvge$dt5$1@fred.mathworks.com>...
> "Stuart McGarrity" <stuartm@mathworks.com> wrote in message
> <fj4oos$bq8$1@fred.mathworks.com>...
> > This undocumented feature is very difficult to use and its
> interface will
> > probably change soon when it becomes documented. function.
> You get an error
> > because t is a java handle and not a regular HG handle.
> >
> > Try this:
> > >>t = uitable({'a', 'b'}, {'col_1', 'col_2'})
> > >>t.setData({'c', 'd'})
> >
> > You can look at some usage examples in this application:
> >
> http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=16075&objectType=FILE
> >
> > Stuart
> >
> > "Stephane Carlier" <youfellow@hotmail.com> wrote in message
> > news:fj4a0k$1v$1@fred.mathworks.com...
> > > Recently I have great frustration using the "undocumented"
> > > uitable functionality. Although it works fine with numerical
> > > matrix, it doesn't work with cell array, e.g.,
> > >
> > > Matlab command
> > > t = uitable({'a', 'b'}, {'col_1', 'col_2'})
> > > behaves as expected. It creates a table with 2 columns and
> > > two table entries.
> > >
> > > However, subsequently:
> > > set(t, 'Data', {'c', 'd'})
> > > generates an error: "??? Object belongs to an incompatible
> > > Java class."
> > >
> > > Could someone shine some light on this? Thank you,
> >
> >
>
>
> Hello,
> i try to update a uitable which contains a basic matrix of
> numbers. How can i do it (using the setData i suppose)?
> typically, my table t contains matrix Datatable, and i want
> to update the table with a new matrix Datatable_updated.
> the basic command t.setData(Datable_updated) doesn't work.
> What is the syntax when you want to update a table?
> thanks
>
>
>
>
>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
uitable Stephane Carlier 4 Dec, 2007 14:35:03
undocumented Stephane Carlier 4 Dec, 2007 14:35:03
rssFeed for this Thread

Contact us at files@mathworks.com