### Tags: array, cell, containing, frustration, functionality, matlab, numericalmatrix, programming, strings, uitable, undocumented

# uitable on cell array containing strings

On Programmer » Matlab

3,835 words with 4 Comments; publish: Wed, 30 Apr 2008 13:52:00 GMT; (20078.13, « »)

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,

*http://matlab.todaysummary.com/q_matlab_61206.html*

All Comments

Leave a comment...

- 4 Comments
- 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.matlab.todaysummary.com.hotmail.com> wrote in message

<fj4a0k$1v$1.matlab.todaysummary.com.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,

#1; Wed, 30 Apr 2008 13:53:00 GMT

- Well, I figured out myself. Remembering what Yair said last
- 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.

#2; Wed, 30 Apr 2008 13:54:00 GMT

- Stuart,
- "Stephane Carlier" <youfellow.matlab.todaysummary.com.hotmail.com> wrote in message
<fj6g5s$svh$1.matlab.todaysummary.com.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

#3; Wed, 30 Apr 2008 13:55:00 GMT

- "Stephane Carlier" <youfellow.matlab.todaysummary.com.hotmail.com> wrote in message
- "Stuart McGarrity" <stuartm.matlab.todaysummary.com.mathworks.com> wrote in message
<fj4oos$bq8$1.matlab.todaysummary.com.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:

> You can look at some usage examples in this application:

>

[url]http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=16075&objectType=FILE[/u

rl]

> Stuart

> "Stephane Carlier" <youfellow.matlab.todaysummary.com.hotmail.com> wrote in message

> news:fj4a0k$1v$1.matlab.todaysummary.com.fred.mathworks.com...

>

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

#4; Wed, 30 Apr 2008 13:56:00 GMT

- "Stuart McGarrity" <stuartm.matlab.todaysummary.com.mathworks.com> wrote in message