uitable on cell array containing strings

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,
0
12/4/2007 7:32:36 PM
comp.soft-sys.matlab 206917 articles. 560 followers. lunamoonmoon (258) is leader. Post Follow

6 Replies
340 Views

Similar Articles

[PageSpeed] 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,

0
12/4/2007 7:53:20 PM
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, 


0
stuartm (470)
12/4/2007 11:44:28 PM
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. 
0
12/5/2007 3:30:04 PM
"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 

0
altmanyDEL (1141)
2/2/2008 4:40:04 PM
"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





0
2/21/2008 1:49:02 PM
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
> 
> 
> 
> 
> 
0
7/9/2009 9:45:18 PM
Reply:
Similar Artilces:

uitable: rowselection
I want to use uitable in an interactive way, but controlled from the my data. Anybody knows how to mark a row in the table programatically? The row should be highlighted. Thanks, Marco "Marco Ruijken" <mruijken@hotmail.com> wrote in message <kn6a5d$a86$1@newscl01ah.mathworks.com>... > I want to use uitable in an interactive way, but controlled from the my data. > Anybody knows how to mark a row in the table programatically? The row should be highlighted. > > Thanks, Marco You would have to access the underlying java JTable. Since uitable change...

More support for Paul's array terminology
To be fair, it just occurred to me, as an example, that we do say "pointer to array of pointers" and not "pointer to first element in an array of pointers". And now I will probably have to kill this thread... Thanks to Ian Collins for the 'K' key tip for Thunderbird! Cheers & hth., - Alf -- blog at <url: http://alfps.wordpress.com> Alf P. Steinbach /Usenet wrote: > To be fair, it just occurred to me, as an example, that we do say "pointer > to array of pointers" and not "pointer to first element in an array of > pointers&q...

quickly finding a cons cell
Is there a clever way in SKILL to do somthing which sort of mixes the functionality of (foreach map....) with exists? I want the test applied to the cons cell, not to the car of the cons cell. As (foreach .... ) is to (exists ...) (foreach map ...) is to what? The exists function does not take an optional mapping function similar to foreach, but IF IT DID this is what i'd like to do. (exists map sub '(1 2 3 4 5 6 7) ((cadr map) > 3)) ---> (3 4 5 6 7) What's the most efficient/fastest way to do this? -jim On 16 Apr 2006 03:27:57 -0700, "Jimka" <jimka@r...

Re: Arrays
On Fri, Aug 8, 2008 at 12:04 PM, Samson Gebreab <samygeb@gmail.com> wrote offline: > Hi Muthia, > > The code is very fantistic, it works especially with the simulated > data you created. With my data it worked with the 24hr average and > day and night average. But, It is giving me missing values for some > the 3hrs average. My data is not as prefect as the simulated data you > created. I realized that most of the measures are taken every 20 > minitues (1200 seconds) but some of them are also taken less than 1200 > seconds. There are also some measures that are...

NYC Taxicabs to Test Cell Signal Strength
By DAVID B. CARUSO, Associated Press Writer Ever wanted to stuff that "Can you hear me now?" guy into the trunk of your car and take him on a tour of those maddening spots where your cell phone won't work? One telecommunications company has a plan to do the mechanical equivalent. The Stockholm-based firm Ericsson recently got approval from New York's taxi commission to place mobile sensors in the trunks of at least 50 cabs in an attempt to better map dead zones in mobile phone networks. The small devices, about the size of a computer modem, will automaticall...

Combination of two arrays
Greetings!=20 Let me start by clarifying that this is just a request for style suggestions... So I won't be hugely disappointed if the plain old way works just fine. I have two arrays. let's call them foo and bar.=20 foo =3D [ "a", "b", "c", ... n ] bar =3D [ 1 , 2 , 3 , ... m ] I am looking for a way to combine them such that the result is something li= ke [ [ "a", 1 ], [ "a", 2 ], ... [ "a", m ], [ "b", 1 ], ... [ n, 1 ], ... [ n, m ] ] I thought that foo * bar would do it, but upon it failing I checked wit...

Replacing text containing parenthesis
I am using perl as a find and replace tool. I want to replace the following text with a null: $(srcdir)/config/override.m4 I tried the following: find ./ -name Makefile.in -exec perl -pi -e \ "s/\$\(top_srcdir\)\/\.\.\/config\/override\.m4//g;" {} \; Unfortunately, this gives an error: Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE top_srcdir\)/\.\./ \ config/override\.m4/ at -e line 1, <> line 1. I guess that the brackets are being evaluated first, and being treated as part of the expression. How do I represent literal brackets within the expression? Ma...

Initialising an array
I wrote the following line in a program: int par[MAX] = { INT_MAX }; and when I iterated through the array I found that only par[0] is equal to INT_MAX (and the rest were zero). Why? Please, if possible, point to me to a good section on initialisations *and* arrays in K&R. TIA, Albert Albert wrote: > I wrote the following line in a program: > > int par[MAX] = { INT_MAX }; > > and when I iterated through the array I found that only par[0] is equal > to INT_MAX (and the rest were zero). Why? That's the rule in C if you supply fewer initialis...

The PCL Challenge, Cells Inside(tm)
Yo, what is the coolest project in PCL? I am toying with throwing together a Celtk (+ Cells LTk (+ Lisp Tk)) GUI for one of them, and wonder which one you noobs think would be a good candidate. Once I get Cells3/Celtk2 in CVS we can evolve it collaboratively so folks get a real-world idea of how to do Cells (and LTk). If not I will do an iPhoto rip-off or somethin. ken -- Cells: http://common-lisp.net/project/cells/ "And I will know my song well before I start singing." - Bob Dylan > Yo, what is the coolest project in PCL? I am toying with throwing > together a Celt...

Dynamic Array Dimensioned?
Greetings. I'm wondering how this would properly be handled. Suppose I have a Global DynamicArray() declared in a public module. Now, in a routine somewhere, I check for the next available element of this array so that I can add more information. I use the UBound method to do this. However, if the array has never been Redim'd because it is going to receive its first piece of information, Ubound won't work. Do I have to perform a Redim DynamicArray(0) in some initialization routine that perhaps is ran when the program first starts, or is there some method I'm not awar...

array package changes font size
Hello, <http://www.cse.unsw.edu.au/~rvg/EPTCS/eptcsstyle.zip> contains a class file for the EPTCS journal and an example TeX file example.tex. If I process the latter with pdfLaTeX, I get a proper PDF file. However, if I add the line \usepackage{array} and process it with pdfLaTeX, the font size of the author’s affiliations gets smaller. Does anyone know what’s the reason for this and/or how to work around this problem? By the way, the author’s affiliations are typeset using the \institute macro which is defined in eptcs.cls as follows: \newcommand{\insti...

Re: Distractions While Driving -- And Not Just Cell Phones
Carl Moore <cmoore@arl.army.mil> wrote: > earlier on Interstate 81) that it is illegal in NY state to use a > handheld phone while driving (I don't have it in front of me what > emergency exception might exist). But I occasionally saw drivers > using handheld phones anyway in NY state. It's illegal to use a cell phone without handsfree in NYS, if I recall correctly. But only without a handsfree - with handsfree it's still legal. JustThe.net Internet & New Media Services, Apple Valley, CA Steven J. Sobol, Geek In Charge / 888.480.4NET (4638) / s...

Some thoughts on memory allocation optimization for arrays of strings
Hi everybody, &nbsp; trying to optimize the memory usage of my program... I need to&nbsp;assemble an array of strings (variable lengths); for this I intend to use the "Initialize Array" function in order to avoid too many accesses to the memory manager. So far so good, but if I see that right, the manager is invoked again, if I try to replace a certain element within this array, because the string length is adjusted. Is that right so far? If it is; would the following procedure improve the behaviour? 1.) Init an array of strings with the appropriate number of elements (stri...

searching bit arrays
Problem: You have a bit array of lets say 800 bits: BYTE bitmap[100] = {0}; at some point this map gets filled in with zero's and ones. Question: How would I find the first bit in the array which is part of N consecutive zero bits? It is not so hard to do this, but I was wondering if there are some optimized ways of doing these kind of things. File systems oftem employ such bitmaps for sector remapping ect. (see UDF). ...

uitable
Hi Everybody Why is this code not showing the uitable? There is something wrong with the position and units? fh=figure('name','Example',... 'numbertitle','off',... 'menubar','none',... 'color',[0.85, 0.85, 0.85],... %Change the color of the figure 'units','normalized',... 'position',[0.3, 0.7,0.4 0.2]); %Change the dimensions of the figure window th = uitable('Data',magic(4),... 'position',[0.4 0.7 0.2 0.2]); Best Regards Hans "Hans " <jyd...

How to pass an array of objects from C++ to Java using JNI
I need to pass from C++ to Java using JNI an array of orbitrary number of objetcts, each object consists of a string and a float. All suggestions are really appriciated! Thanaks ...

dynamic arrays again
Hi, Another question about dynamic arrays. When I ReDim them I loose all my data. Of course I could write a method which first copies every item into a temporary array and after rediming copies it back. But doesn't VB has a more powerfull way for resizing without loosing data? In my case resizing means making the array 1 bigger each time. Greetings, Rick > Another question about dynamic arrays. When I ReDim them I loose all my > data. Of course I could write a method which first copies every item into a > temporary array and after rediming copies it back. But d...

FAQ 4.36 How can I expand variables in text strings? #9 297988
This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.36: How can I expand variables in text strings? (contributed by brian d foy) If you can avoid it, don't, or if you can use a templating system, such as "Text::Template" or "Template" T...

Validating a regex replacement string
I'm trying to validate a replacement string during construction time, but the only way I found is really ugly. Please let me know if there's a better way. Thank you, Avshi Avital This is how I do it: /** * Verifying the replacement string is a bit awkward, * because the only way to do this is to run the * replacement string on a text that the regex matches * and see if an exception is thrown. * We chit by counting the number of capturing groups * in the regex and then creating a fake regex that * contains that many capturing groups. Since we * construct the (fake) regex, we...

Re: [QUIZ] Maximum Sub-Array (#131) #2
Hello, everybody! I am new here. I am also relatively new to ruby. I don't know if it's OK to ask questions here before the 48 hours period ends. So I am going to shoot straight and ask. I am trying to create a perfect regexp match string to match an array string like [1, -1, 4, 5] So far the best I've came up with is /^\[-*\d+,*.*\]$/ If I add \s+ the string doesn't match. /^\[-*\d+,*\s+.*\]$/ And I have no idea why... On Jul 14, 2007, at 12:21 PM, Anton wrote: > Hello, everybody! I am new here. I am also relatively new to ruby. > > I don't know if it's ...

cell array manipulation
how do i search through cell arrays for specific values? more info follows: i have a cell array called matches of the form (without the quotes): 'C231C417C5379C11437' 'C170C315C555C1137' 'C16C48C160C1352' 'C26C134C217C555' 'C48C160C4479C12624' 'C197C1081C1353C5125' 'C5C6C25C26' 'C37C84C188C1242' 'C188C1242C2051C5519' 'C5C6C26C217' 'C37C84C188C2051' 'C188C1242C2051C5519' 'C22C118C197C1146' the length of this is variable on different datasets. call each row of matches a false reaction. i h...

How to show symbolic object in uitable?
How can I show symbolic object in uitable? syms i2,i3 'real'; a=[ 0 0 -i3; 1 2 3]; a(2,2)=-i2; set(handles.uitable2, 'Data',a); On 02.11.11 14:07, vansac wrote: > How can I show symbolic object in uitable? > > syms i2,i3 'real'; > > a=[ 0 0 -i3; 1 2 3]; > > a(2,2)=-i2; > > set(handles.uitable2, 'Data',a); Try: set(handles.uitable2, 'Data', ... arrayfun(@char, a, 'UniformOutput', false)) Christopher ...

Axe your cell contract to get an iPhone
http://www.wired.com/gadgets/wireless/news/2007/06/iphone_howto In article <replytogroup-666770.16032027062007@news.lga.highwinds-media.com>, The New Guy <replytogroup@here.thanks> wrote: > http://www.wired.com/gadgets/wireless/news/2007/06/iphone_howto While the iPhone is cool and have some pangs of wanting one, the cheapest of the AT&T plans is double what I pay for my Sprint service- not to mention that the phone costs ten times what I paid for mine. I think I'll wait a couple of years. On 2007-06-27 14:03:20 -0700, The New Guy <replytogroup@here.thanks...

why can't I pickle a class containing this dispatch dictionary?
Hi All I'm clearly not understanding the 'can't pickle instancemethod objects' error; can someone help me to understand, & maybe suggest a workaround, (apart from the obvious if ... elif...). I'm running Python 2.6 on an embedded system. == testpickle.py == import pickle class Test(object): def __init__(self): self.myDict = { 1: self.tag1, 2: self.tag2 } def dispatch(self, v): try: self.myDict[v]() except KeyError: print "No corresponding dictionary entry!" ...

Numeric array equivalent of index ?
Hello, I'm trying to find a clear and fast equivalent to the index method of plain python list : >> a = [5,1,4,3,4] >> a.index(4) 2 I have to use it on a Numeric array, so the best I've come up with is (rather ugly I think) : >> from Numeric import array, equal, nonzero >> a = array([5,1,4,3,4]) >> nonzero(equal(a,4))[0] 2 Does someone know of a more Pythonic way ? Thanks, Nicolas Pernetty wrote: > Hello, > > I'm trying to find a clear and fast equivalent to the index method of > plain python list : > >>>a = [5,1,4,3,4] ...