Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem using uitable component with Matlab Compiler Runtime

Subject: problem using uitable component with Matlab Compiler Runtime

From: Peter Shargo

Date: 23 Mar, 2008 07:54:03

Message: 1 of 21

Hi -
  Anybody out there able to compile and successfully run any
applications that use the uitable component? I
cut-and-pasted the following code directly from the uitable
documentation (Example 2, if you do 'doc uitable') into a
script I called test_uitable.m and compiled using the R2008a
Matlab Compiler. Though the function works fine when used
from within Matlab itself, it doesn't work right in the
compiled application. I
get the following error:

com.mathworks.jmi.MatlabException: Error using ==> uitable
Undefined function or method 'arrayviewfunc' for input
arguments of type 'hg.uitable'.

Even if I explicitly add Matlab's arrayviewfunc.m file (it's
in ...\toolbox\matlab\codetools) to the deploytool project
file, I still get the same error (I tried it both on
WindowsXP and 64-bit Linux). Anybody got an ideas? Mathworks
folks? Thanks in advance!

-Pete

----------------
% test_uitable.m
f = figure('Position',[100 100 300 150]);
dat = rand(3);
cnames = {'X-Data','Y-Data','Z-Data'};
t = uitable('Data',dat,'ColumnName',cnames,...
            'Parent',f,'Position',[20 20 250 100]);

Subject: problem using uitable component with Matlab Compiler Runtime

From: John

Date: 26 Mar, 2008 20:15:10

Message: 2 of 21


I have this same issue. I have converted some of my
undocumented
uitable guis into the now supported uitable and tried to
compile.
Each one returns that exact error when I try to open the
program...

Undefined function or method 'arrayviewfunc' for input
arguments of type 'hg.uitable'.
    at
com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
    at
com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:
211)
    at
com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:
121)
    at com.mathworks.jmi.Matlab.mtFeval(Matlab.java:1432)
    at com.mathworks.hg.peer.ui.table.DefaultUIStyleTableModel
$UITableValueTableModel
$1.runOnMatlabThread(DefaultUIStyleTableModel.java:433)
    at
com.mathworks.jmi.MatlabWorker$2.run(MatlabLooper.java:73)
    at
com.mathworks.jmi.MatlabWorker.start(MatlabLooper.java:226)
    (....on and on)

The guis work great in the matlab environment, but not when
deployed as an executable.

Subject: problem using uitable component with Matlab Compiler Runtime

From: John

Date: 26 Mar, 2008 21:26:01

Message: 3 of 21

I was able to get around this initial issue by saving a copy
of arrayviewfunc.m into the working folder, and then using
the -a option to attach it directly in the mcc call...

But then the next function uitable calls results in this
crash (workspacefunc).

"./toolbox/matlab/codetools" is an included path on my
setpaths, so i don't see why this is an issue.

Subject: problem using uitable component with Matlab Compiler Runtime

From: John

Date: 26 Mar, 2008 21:53:02

Message: 4 of 21

Workaround...

create a copy of the codetools folder in the working folder
and attach the entire thing during the mcc call.

(attaching the folder from its original location did not
seem to work)

Subject: problem using uitable component with Matlab Compiler Runtime

From: colin

Date: 27 Mar, 2008 14:47:00

Message: 5 of 21

On Mar 26, 11:53 pm, "John " <john.s.macom...@boeing.com> wrote:
> Workaround...
>
> create a copy of the codetools folder in the working folder
> and attach the entire thing during the mcc call.
>
> (attaching the folder from its original location did not
> seem to work)

Actually it's only arrayviewfunc and workspacefunc that need to be
included. Another workaround which works for some people, is to use
the pragma
%#function arrayviewfunc workspacefunc
in the preamble of your gui's m-file.

It seems to work or not work depending on whether you still have
R2007b installed, as there seems to be a bug in reading the correct
startup.m file.
I have spoken with the The MathWorks people, and they say that other
than John's workaround there is no solution to this issue.

Subject: problem using uitable component with Matlab Compiler Runtime

From: Hiriyur@gmail.com

Date: 4 Apr, 2008 22:22:22

Message: 6 of 21

On Mar 27, 7:47 am, colin <noidfr...@gmail.com> wrote:
> On Mar 26, 11:53 pm, "John " <john.s.macom...@boeing.com> wrote:
>
> > Workaround...
>
> > create a copy of the codetools folder in the working folder
> > and attach the entire thing during the mcc call.
>
> > (attaching the folder from its original location did not
> > seem to work)
>
> Actually it's only arrayviewfunc and workspacefunc that need to be
> included. Another workaround which works for some people, is to use
> the pragma
> %#function arrayviewfunc workspacefunc
> in the preamble of your gui's m-file.
>
> It seems to work or not work depending on whether you still have
> R2007b installed, as there seems to be a bug in reading the correct
> startup.m file.
> I have spoken with the The MathWorks people, and they say that other
> than John's workaround there is no solution to this issue.

I was having the same problem. I have a gui which has two uitable
components - one showing only numeric array data and the other showing
a cell variable with both numeric and character data. They both worked
fine in MATLAB environment, but had problems when compiled. I added
arrayviewfunc and workspacefunc to my project directory and
recompiled. All the errors vanished, but still there are some issues.

The first uitable showing numeric array works great, but the other
uitable initialized to show cell data doesn't show anything. Its
blank. Moreover, even when I try to manually fill in the cells
(ColumnEditable is set to 1), the cells do not retain these values
when I navigate to other cells. Anyone else had this problem?

Thanks in advance,
BK

Subject: problem using uitable component with Matlab Compiler Runtime

From: colin

Date: 7 Apr, 2008 06:53:24

Message: 7 of 21

On Apr 5, 12:22 am, Hiri...@gmail.com wrote:
> On Mar 27, 7:47 am, colin <noidfr...@gmail.com> wrote:
>
>
>
> > On Mar 26, 11:53 pm, "John " <john.s.macom...@boeing.com> wrote:
>
> > > Workaround...
>
> > > create a copy of the codetools folder in the working folder
> > > and attach the entire thing during the mcc call.
>
> > > (attaching the folder from its original location did not
> > > seem to work)
>
> > Actually it's only arrayviewfunc and workspacefunc that need to be
> > included. Another workaround which works for some people, is to use
> > the pragma
> > %#function arrayviewfunc workspacefunc
> > in the preamble of your gui's m-file.
>
> > It seems to work or not work depending on whether you still have
> > R2007b installed, as there seems to be a bug in reading the correct
> > startup.m file.
> > I have spoken with the The MathWorks people, and they say that other
> > than John's workaround there is no solution to this issue.
>
> I was having the same problem. I have a gui which has two uitable
> components - one showing only numeric array data and the other showing
> a cell variable with both numeric and character data. They both worked
> fine in MATLAB environment, but had problems when compiled. I added
> arrayviewfunc and workspacefunc to my project directory and
> recompiled. All the errors vanished, but still there are some issues.
>
> The first uitable showing numeric array works great, but the other
> uitable initialized to show cell data doesn't show anything. Its
> blank. Moreover, even when I try to manually fill in the cells
> (ColumnEditable is set to 1), the cells do not retain these values
> when I navigate to other cells. Anyone else had this problem?
>
> Thanks in advance,
> BK

I have not had this problem, but I imagine it has something to do with
the cell format of the data. It is strange that it would work in
MATLAB,
but not in the compiled version, but given the arrayviewfunc issues
above,
it's not really surprising.

My advice is to look at the CellEditCallback. Hopefully with a bit
more
sophistication in the data format handling, you can get around this
issue without ever knowing what the issue is ;-)

Please let me know if you do find a solution, as I will probably
encounter
this issue myself before too long.

Subject: problem using uitable component with Matlab Compiler Runtime

From: Badri Hiriyur

Date: 7 Apr, 2008 19:07:02

Message: 8 of 21

So far I have not found a real solution to using the new
uitable component in a compiled program. There are some
cases where it does seem to be working with cells in a
simple program I made up to test this anomaly (e.g.
mat2cell(rand(... ) and I haven't yet isolated the portion
that throws it off. For now I am making do with the older
obsolete uitable function.

Bk

colin <noidfreak@gmail.com> wrote in message
<95819f64-e446-4af9-bf63-cca57b809a2c@z38g2000hsc.googlegroups.com>...
> On Apr 5, 12:22 am, Hiri...@gmail.com wrote:
> > On Mar 27, 7:47 am, colin <noidfr...@gmail.com> wrote:
> >
> >
> >
> > > On Mar 26, 11:53 pm, "John "
<john.s.macom...@boeing.com> wrote:
> >
> > > > Workaround...
> >
> > > > create a copy of the codetools folder in the working
folder
> > > > and attach the entire thing during the mcc call.
> >
> > > > (attaching the folder from its original location did not
> > > > seem to work)
> >
> > > Actually it's only arrayviewfunc and workspacefunc
that need to be
> > > included. Another workaround which works for some
people, is to use
> > > the pragma
> > > %#function arrayviewfunc workspacefunc
> > > in the preamble of your gui's m-file.
> >
> > > It seems to work or not work depending on whether you
still have
> > > R2007b installed, as there seems to be a bug in
reading the correct
> > > startup.m file.
> > > I have spoken with the The MathWorks people, and they
say that other
> > > than John's workaround there is no solution to this issue.
> >
> > I was having the same problem. I have a gui which has
two uitable
> > components - one showing only numeric array data and the
other showing
> > a cell variable with both numeric and character data.
They both worked
> > fine in MATLAB environment, but had problems when
compiled. I added
> > arrayviewfunc and workspacefunc to my project directory and
> > recompiled. All the errors vanished, but still there are
some issues.
> >
> > The first uitable showing numeric array works great, but
the other
> > uitable initialized to show cell data doesn't show
anything. Its
> > blank. Moreover, even when I try to manually fill in the
cells
> > (ColumnEditable is set to 1), the cells do not retain
these values
> > when I navigate to other cells. Anyone else had this
problem?
> >
> > Thanks in advance,
> > BK
>
> I have not had this problem, but I imagine it has
something to do with
> the cell format of the data. It is strange that it would
work in
> MATLAB,
> but not in the compiled version, but given the
arrayviewfunc issues
> above,
> it's not really surprising.
>
> My advice is to look at the CellEditCallback. Hopefully
with a bit
> more
> sophistication in the data format handling, you can get
around this
> issue without ever knowing what the issue is ;-)
>
> Please let me know if you do find a solution, as I will
probably
> encounter
> this issue myself before too long.

Subject: problem using uitable component with Matlab Compiler Runtime

From: jackstraw

Date: 14 Apr, 2008 13:24:02

Message: 9 of 21

"Badri Hiriyur" <Hiriyur@gmail.com> wrote in message
<ftdrcm$2uu$1@fred.mathworks.com>...
> So far I have not found a real solution to using the new
> uitable component in a compiled program. There are some
> cases where it does seem to be working with cells in a
> simple program I made up to test this anomaly (e.g.
> mat2cell(rand(... ) and I haven't yet isolated the
portion
> that throws it off. For now I am making do with the older
> obsolete uitable function.
>
> Bk
>
> colin <noidfreak@gmail.com> wrote in message
> <95819f64-e446-4af9-bf63-
cca57b809a2c@z38g2000hsc.googlegroups.com>...
> > On Apr 5, 12:22 am, Hiri...@gmail.com wrote:
> > > On Mar 27, 7:47 am, colin <noidfr...@gmail.com>
wrote:
> > >
> > >
> > >
> > > > On Mar 26, 11:53 pm, "John "
> <john.s.macom...@boeing.com> wrote:
> > >
> > > > > Workaround...
> > >
> > > > > create a copy of the codetools folder in the
working
> folder
> > > > > and attach the entire thing during the mcc call.
> > >
> > > > > (attaching the folder from its original location
did not
> > > > > seem to work)
> > >
> > > > Actually it's only arrayviewfunc and workspacefunc
> that need to be
> > > > included. Another workaround which works for some
> people, is to use
> > > > the pragma
> > > > %#function arrayviewfunc workspacefunc
> > > > in the preamble of your gui's m-file.
> > >
> > > > It seems to work or not work depending on whether
you
> still have
> > > > R2007b installed, as there seems to be a bug in
> reading the correct
> > > > startup.m file.
> > > > I have spoken with the The MathWorks people, and
they
> say that other
> > > > than John's workaround there is no solution to
this issue.
> > >
> > > I was having the same problem. I have a gui which has
> two uitable
> > > components - one showing only numeric array data and
the
> other showing
> > > a cell variable with both numeric and character data.
> They both worked
> > > fine in MATLAB environment, but had problems when
> compiled. I added
> > > arrayviewfunc and workspacefunc to my project
directory and
> > > recompiled. All the errors vanished, but still there
are
> some issues.
> > >
> > > The first uitable showing numeric array works great,
but
> the other
> > > uitable initialized to show cell data doesn't show
> anything. Its
> > > blank. Moreover, even when I try to manually fill in
the
> cells
> > > (ColumnEditable is set to 1), the cells do not retain
> these values
> > > when I navigate to other cells. Anyone else had this
> problem?
> > >
> > > Thanks in advance,
> > > BK
> >
> > I have not had this problem, but I imagine it has
> something to do with
> > the cell format of the data. It is strange that it
would
> work in
> > MATLAB,
> > but not in the compiled version, but given the
> arrayviewfunc issues
> > above,
> > it's not really surprising.
> >
> > My advice is to look at the CellEditCallback.
Hopefully
> with a bit
> > more
> > sophistication in the data format handling, you can get
> around this
> > issue without ever knowing what the issue is ;-)
> >
> > Please let me know if you do find a solution, as I will
> probably
> > encounter
> > this issue myself before too long.
>

The following gives a blank uitable when deployed, any
ideas. It also happens for any function that calls drawnow.

f = figure;
w = waitbar(0,'uitable test');
uit = uitable('data',rand(10,3));
w = waitbar(1,w,'uitable test');
close(w);

mcc -m uitable_test.m -a workspacefunc.m -a arrayviewfunc.m

Subject: problem using uitable component with Matlab Compiler Runtime

From: jackstraw

Date: 15 Apr, 2008 15:57:01

Message: 10 of 21

"jackstraw " <feasolutions@yahoo.com> wrote in message
<ftvlti$o4j$1@fred.mathworks.com>...
> "Badri Hiriyur" <Hiriyur@gmail.com> wrote in message
> <ftdrcm$2uu$1@fred.mathworks.com>...
> > So far I have not found a real solution to using the
new
> > uitable component in a compiled program. There are some
> > cases where it does seem to be working with cells in a
> > simple program I made up to test this anomaly (e.g.
> > mat2cell(rand(... ) and I haven't yet isolated the
> portion
> > that throws it off. For now I am making do with the
older
> > obsolete uitable function.
> >
> > Bk
> >
> > colin <noidfreak@gmail.com> wrote in message
> > <95819f64-e446-4af9-bf63-
> cca57b809a2c@z38g2000hsc.googlegroups.com>...
> > > On Apr 5, 12:22 am, Hiri...@gmail.com wrote:
> > > > On Mar 27, 7:47 am, colin <noidfr...@gmail.com>
> wrote:
> > > >
> > > >
> > > >
> > > > > On Mar 26, 11:53 pm, "John "
> > <john.s.macom...@boeing.com> wrote:
> > > >
> > > > > > Workaround...
> > > >
> > > > > > create a copy of the codetools folder in the
> working
> > folder
> > > > > > and attach the entire thing during the mcc
call.
> > > >
> > > > > > (attaching the folder from its original
location
> did not
> > > > > > seem to work)
> > > >
> > > > > Actually it's only arrayviewfunc and
workspacefunc
> > that need to be
> > > > > included. Another workaround which works for
some
> > people, is to use
> > > > > the pragma
> > > > > %#function arrayviewfunc workspacefunc
> > > > > in the preamble of your gui's m-file.
> > > >
> > > > > It seems to work or not work depending on
whether
> you
> > still have
> > > > > R2007b installed, as there seems to be a bug in
> > reading the correct
> > > > > startup.m file.
> > > > > I have spoken with the The MathWorks people, and
> they
> > say that other
> > > > > than John's workaround there is no solution to
> this issue.
> > > >
> > > > I was having the same problem. I have a gui which
has
> > two uitable
> > > > components - one showing only numeric array data
and
> the
> > other showing
> > > > a cell variable with both numeric and character
data.
> > They both worked
> > > > fine in MATLAB environment, but had problems when
> > compiled. I added
> > > > arrayviewfunc and workspacefunc to my project
> directory and
> > > > recompiled. All the errors vanished, but still
there
> are
> > some issues.
> > > >
> > > > The first uitable showing numeric array works
great,
> but
> > the other
> > > > uitable initialized to show cell data doesn't show
> > anything. Its
> > > > blank. Moreover, even when I try to manually fill
in
> the
> > cells
> > > > (ColumnEditable is set to 1), the cells do not
retain
> > these values
> > > > when I navigate to other cells. Anyone else had
this
> > problem?
> > > >
> > > > Thanks in advance,
> > > > BK
> > >
> > > I have not had this problem, but I imagine it has
> > something to do with
> > > the cell format of the data. It is strange that it
> would
> > work in
> > > MATLAB,
> > > but not in the compiled version, but given the
> > arrayviewfunc issues
> > > above,
> > > it's not really surprising.
> > >
> > > My advice is to look at the CellEditCallback.
> Hopefully
> > with a bit
> > > more
> > > sophistication in the data format handling, you can
get
> > around this
> > > issue without ever knowing what the issue is ;-)
> > >
> > > Please let me know if you do find a solution, as I
will
> > probably
> > > encounter
> > > this issue myself before too long.
> >
>
> The following gives a blank uitable when deployed, any
> ideas. It also happens for any function that calls
drawnow.
>
> f = figure;
> w = waitbar(0,'uitable test');
> uit = uitable('data',rand(10,3));
> w = waitbar(1,w,'uitable test');
> close(w);
>
> mcc -m uitable_test.m -a workspacefunc.m -a
arrayviewfunc.m

I'll answer my own question. Mathworks says this is a bug
with no current workaround. Whenever you work with the
uitable and also call any function that calls drawnow,
your deployed uitable goes blank. So what do I do? For now
I will do a cheap fix. Move the uitable to another figure,
then move it back again. It forces it to render the
uitable.

function uitable_test
f = figure;
w = waitbar(0,'uitable test');
uit = uitable('data',rand(10,3));
w = waitbar(1,w,'uitable test');
close(w);
g = figure('visible','off');
set(uit,'parent',g)
set(uit,'parent',f)
close(g);

mcc -m uitable_test.m -a workspacefunc.m -a arrayviewfunc.m

I know, extremely lame fix but I am able to deploy and
meet deadline. Hope they fix this soon.

Subject: problem using uitable component with Matlab Compiler Runtime

From: laurent

Date: 8 May, 2008 20:50:18

Message: 11 of 21

Hello all,

My workaround for the deployment of a gui with an uitable
component is as following:

copy: workspacefunc.m and arrayviewfunc.m to the working
directory.
Add the pragma at the beginning of the m file:
(In the example bellow I assume testTable.fig and
testTable.m have been generated with guide and include a
uitable with tag: uitable1 )

 function varargout = testTable(varargin)
%#function arrayviewfunc workspacefunc
% TESTTABLE M-file for testTable.fig
....

I added a function for updating the uitable:

function UpdateTable(hObject, eventdata, handles)

set(handles.uitable1,'Data',....);
set(handles.uitable1, 'ColumnName',.....);

The main application open the gui and later execute the
update function:

function Main
h= testTable();
testTable('UpdateTable',0,0,guidata(h));
...


I could compile the uitabledemo and the gui behaviour is
OK,

Good Luck !
Laurent

Subject: problem using uitable component with Matlab Compiler Runtime

From: laurent

Date: 8 May, 2008 20:52:03

Message: 12 of 21

Hello all,

My workaround for the deployment of a gui with an uitable
component is as following:

copy: workspacefunc.m and arrayviewfunc.m to the working
directory.
Add the pragma at the beginning of the m file:
(In the example bellow I assume testTable.fig and
testTable.m have been generated with guide and include a
uitable with tag: uitable1 )

 function varargout = testTable(varargin)
%#function arrayviewfunc workspacefunc
% TESTTABLE M-file for testTable.fig
....

I added a function for updating the uitable:

function UpdateTable(hObject, eventdata, handles)

set(handles.uitable1,'Data',....);
set(handles.uitable1, 'ColumnName',.....);

The main application open the gui and later execute the
update function:

function Main
h= testTable();
testTable('UpdateTable',0,0,guidata(h));
...


I could compile the uitabledemo and the gui behaviour is
OK,

Good Luck !
Laurent

Subject: problem using uitable component with Matlab Compiler Runtime

From: Mario

Date: 16 Jul, 2008 13:59:02

Message: 13 of 21

Hi...

I fix that bug changing the file arrayviewfunc.m , if
anyone wants the new release can contact me on email.

Mario Cavaciocchi

Subject: problem using uitable component with Matlab Compiler Runtime

From: dong doudou

Date: 24 Jul, 2008 13:01:25

Message: 14 of 21

"laurent " <laurent.karsenti@gmail.com> wrote in message
<fvvp5j$27h$1@fred.mathworks.com>...
> Hello all,
>
> My workaround for the deployment of a gui with an uitable
> component is as following:
>
> copy: workspacefunc.m and arrayviewfunc.m to the working
> directory.
> Add the pragma at the beginning of the m file:
> (In the example bellow I assume testTable.fig and
> testTable.m have been generated with guide and include a
> uitable with tag: uitable1 )
>
> function varargout = testTable(varargin)
> %#function arrayviewfunc workspacefunc
> % TESTTABLE M-file for testTable.fig
> ....
>
> I added a function for updating the uitable:
>
> function UpdateTable(hObject, eventdata, handles)
>
> set(handles.uitable1,'Data',....);
> set(handles.uitable1, 'ColumnName',.....);
>
> The main application open the gui and later execute the
> update function:
>
> function Main
> h= testTable();
> testTable('UpdateTable',0,0,guidata(h));
> ...
>
>
> I could compile the uitabledemo and the gui behaviour is
> OK,
>
> Good Luck !
> Laurent
>
>
>
i found the programa can initiaied normorlly by using
MCC -m yourwantedfile.m -a workspacefunc.m -a
arrayviewfunc.m
command.
but the gernerated .exe can not be updated immediatially
when changing the data of UITTABLE.
 

Subject: problem using uitable component with Matlab Compiler Runtime

From: dong doudou

Date: 24 Jul, 2008 15:53:17

Message: 15 of 21

"dong doudou" <dodo.dong@163.com> wrote in message <g69uf5
$llj$1@fred.mathworks.com>...
> "laurent " <laurent.karsenti@gmail.com> wrote in message
> <fvvp5j$27h$1@fred.mathworks.com>...
> > Hello all,
> >
> > My workaround for the deployment of a gui with an
uitable
> > component is as following:
> >
> > copy: workspacefunc.m and arrayviewfunc.m to the
working
> > directory.
> > Add the pragma at the beginning of the m file:
> > (In the example bellow I assume testTable.fig and
> > testTable.m have been generated with guide and include
a
> > uitable with tag: uitable1 )
> >
> > function varargout = testTable(varargin)
> > %#function arrayviewfunc workspacefunc
> > % TESTTABLE M-file for testTable.fig
> > ....
> >
> > I added a function for updating the uitable:
> >
> > function UpdateTable(hObject, eventdata, handles)
> >
> > set(handles.uitable1,'Data',....);
> > set(handles.uitable1, 'ColumnName',.....);
> >
> > The main application open the gui and later execute the
> > update function:
> >
> > function Main
> > h= testTable();
> > testTable('UpdateTable',0,0,guidata(h));
> > ...
> >
> >
> > I could compile the uitabledemo and the gui behaviour
is
> > OK,
> >
> > Good Luck !
> > Laurent
> >
> >
> >
> i found the programa can initiaied normorlly by using
> MCC -m yourwantedfile.m -a workspacefunc.m -a
> arrayviewfunc.m
> command.
> but the gernerated .exe can not be updated immediatially
> when changing the data of UITTABLE.
>
>

i found this problem can be resolved well. you can dip into
the address.
http://www.mathworks.cn/support/bugreports/details.html?
rp=449936

Subject: problem using uitable component with Matlab Compiler Runtime

From: Nicolás

Date: 26 Sep, 2008 18:58:01

Message: 16 of 21

Hi Philip. I have the same problem but this time I understood what to do:

1. Copy workspacefunc.m and arrayviewfunc.m to the working
directory
2. generate your GUI using deploytool
3. Copy %#function arrayviewfunc workspacefunc between function varargout = GUIname(varargin) and % GUINAME M-file for GUIname.fig
4. Add

function UpdateTable(hObject, eventdata, handles)

set(handles.uitable1,'Data',....);
set(handles.uitable1,'ColumnName',.....);

, where uitable1 is the name of the table, the first .... are the data you want to load, and the second .... are the names of the columns in the table
5. Now, generate a different function with the name you want (Main in the reply sent by Laurent):

function Main
h= testTable();
testTable('UpdateTable',0,0,guidata(h));

, and compile the Main function, NOT the function of the table

I tried the example sent by Laurent doing these steps and it worked!!

Nicolas

Subject: problem using uitable component with Matlab Compiler Runtime

From: Natasha

Date: 14 Nov, 2008 23:14:02

Message: 17 of 21

Hello,

I am not sure how to use this workaround because my uitable is in a seperate GUI that is called by my main GUI.

For example, if my main GUI is called Test and my 2nd GUI is called TestTables, I call from my main GUI:

TestTables('Test',handles.figureTest);

Does anyone know how I can get the values from this 2nd GUI to display properly in my standalone application?

I tried including the workspacefunc.m and arrayviewfunc.m in the compiled package, but that didn't help. And I'm not sure how to do steps 4 and 5 if the uitable is in a 2ndary GUI.

Thanks for your help!
Natasha

"Nicolas " <odiseo1982@yahoo.com> wrote in message <gbjbbp$r6a$1@fred.mathworks.com>...
> Hi Philip. I have the same problem but this time I understood what to do:
>
> 1. Copy workspacefunc.m and arrayviewfunc.m to the working
> directory
> 2. generate your GUI using deploytool
> 3. Copy %#function arrayviewfunc workspacefunc between function varargout = GUIname(varargin) and % GUINAME M-file for GUIname.fig
> 4. Add
>
> function UpdateTable(hObject, eventdata, handles)
>
> set(handles.uitable1,'Data',....);
> set(handles.uitable1,'ColumnName',.....);
>
> , where uitable1 is the name of the table, the first .... are the data you want to load, and the second .... are the names of the columns in the table
> 5. Now, generate a different function with the name you want (Main in the reply sent by Laurent):
>
> function Main
> h= testTable();
> testTable('UpdateTable',0,0,guidata(h));
>
> , and compile the Main function, NOT the function of the table
>
> I tried the example sent by Laurent doing these steps and it worked!!
>
> Nicolas

Subject: problem using uitable component with Matlab Compiler Runtime

From: Alex

Date: 16 Jan, 2009 16:05:04

Message: 18 of 21

"John " <john.s.macomber@boeing.com> wrote in message <fsegju$g1f$1@fred.mathworks.com>...
> Workaround...
>
> create a copy of the codetools folder in the working folder
> and attach the entire thing during the mcc call.
>
> (attaching the folder from its original location did not
> seem to work)


I used this work around and it solved my problems with GUI but I have problems now with pragmas elsewhere. Could it be that the bug generally disables pragmas?

I'm trying to use findpeaks.m which previously required that I insert the pragma:
%#function dspopts.findpeaks
so that the following statement would compile correctly:
[hopts,msg] = uddpvparse('dspopts.findpeaks',varargin{:});

Now that I've added a slick new GUI to the front end, I now have problems with the missing dspopts.findpeaks again.

I'm confused about what I should add to the archive to get this to work -- just dspopts.findpeaks doesn't seem to be enough, nor does directory containing findpeaks.m. Moving up directory structure it starts to get very large very fast!
I tried adding the entire signal


Any ideas?
???
--Alex.

Subject: problem using uitable component with Matlab Compiler Runtime

From: Alex

Date: 19 Jan, 2009 12:00:04

Message: 19 of 21

"Alex " <atumlins@gmail.com> wrote in message <gkqb7g$hr3$1@fred.mathworks.com>...
> "John " <john.s.macomber@boeing.com> wrote in message <fsegju$g1f$1@fred.mathworks.com>...
> > Workaround...
> >
> > create a copy of the codetools folder in the working folder
> > and attach the entire thing during the mcc call.
> >
> > (attaching the folder from its original location did not
> > seem to work)
>
>
> I used this work around and it solved my problems with GUI but I have problems now with pragmas elsewhere. Could it be that the bug generally disables pragmas?
>
> I'm trying to use findpeaks.m which previously required that I insert the pragma:
> %#function dspopts.findpeaks
> so that the following statement would compile correctly:
> [hopts,msg] = uddpvparse('dspopts.findpeaks',varargin{:});
>
> Now that I've added a slick new GUI to the front end, I now have problems with the missing dspopts.findpeaks again.
>
> I'm confused about what I should add to the archive to get this to work -- just dspopts.findpeaks doesn't seem to be enough, nor does directory containing findpeaks.m. Moving up directory structure it starts to get very large very fast!
> I tried adding the entire signal
>
>
> Any ideas?
> ???
> --Alex.

I guess it is the -a compiler option that caused the problems with my other pragmas.
I tried adding the .\codetools to some code that did not include the GUI and it caused the same errors.

I went back and tried one of the later solutions that used pragmas right after function declaration and stopped using mcc -a with success.

--Alex.

Subject: problem using uitable component with Matlab Compiler Runtime

From: Carla

Date: 22 Jun, 2009 18:03:01

Message: 20 of 21

Hiriyur@gmail.com wrote in message <5009c33b-b8ca-464d-b20b-cdbd81e869cd@2g2000hsn.googlegroups.com>...
> On Mar 27, 7:47 am, colin <noidfr...@gmail.com> wrote:
> > On Mar 26, 11:53 pm, "John " <john.s.macom...@boeing.com> wrote:
> >
> > > Workaround...
> >
> > > create a copy of the codetools folder in the working folder
> > > and attach the entire thing during the mcc call.
> >
> > > (attaching the folder from its original location did not
> > > seem to work)
> >
> > Actually it's only arrayviewfunc and workspacefunc that need to be
> > included. Another workaround which works for some people, is to use
> > the pragma
> > %#function arrayviewfunc workspacefunc
> > in the preamble of your gui's m-file.
> >
> > It seems to work or not work depending on whether you still have
> > R2007b installed, as there seems to be a bug in reading the correct
> > startup.m file.
> > I have spoken with the The MathWorks people, and they say that other
> > than John's workaround there is no solution to this issue.
>
> I was having the same problem. I have a gui which has two uitable
> components - one showing only numeric array data and the other showing
> a cell variable with both numeric and character data. They both worked
> fine in MATLAB environment, but had problems when compiled. I added
> arrayviewfunc and workspacefunc to my project directory and
> recompiled. All the errors vanished, but still there are some issues.
>
> The first uitable showing numeric array works great, but the other
> uitable initialized to show cell data doesn't show anything. Its
> blank. Moreover, even when I try to manually fill in the cells
> (ColumnEditable is set to 1), the cells do not retain these values
> when I navigate to other cells. Anyone else had this problem?
>
> Thanks in advance,
> BK

A workaround for the non-updating of cell array data in the uitable that works for my compiled gui is to clear all of the cells before setting the new values, e.g:

set(hTable, 'data', cell(size(newData)))
set(hTable, 'data', newData)

where hTable is the handle to your uitable and newData is the new cell array. Hope this helps someone!

Subject: problem using uitable component with Matlab Compiler Runtime

From: Albert

Date: 11 Jan, 2012 19:06:08

Message: 21 of 21

None of the workarounds above worked for me when I tried to display Strings in the uitable after compiling it. So, here was my solution:

I looked into the uitable code and picked up the following portion as a new function for creating uitables: (please note that this function is the most basic and doesn't check for any errors for size, or input arguments etc)

----------------------------------------------------------------------------------------------------------------
function obj = uitable_damla(parent,colnum,columnwidth,position,colnames,data)

import com.mathworks.hg.peer.UitablePeer;

if isempty(parent)
    parent = gcf; % Get the current figure. Create one if not available
end

if (~exist('data_model', 'var'))
    data_model = javax.swing.table.DefaultTableModel;
end
    data_model.setColumnCount(colnum);

table_h= UitablePeer(data_model);
% We should have valid data and column names here.
table_h.setData(data);
table_h.setColumnNames(colnames);
table_h.setColumnWidth(columnwidth);

% pass the specified parent and let javacomponent decide its validity.
[obj, container] = javacomponent(table_h, position, parent);
% javacomponent returns a UDD handle for the java component passed in.
table = obj;

-------------------------------------------------------------------------------------------------------------
Example call from my .m file:
%creating the table
     data={'2011.12.27','PA Failure';'2011.11.07', 'Input Overload';...
    '2011.10.25','Output Overdrive';'2011.10.05', 'Over Temperature'};
    colnames = {'Alarm Dates', 'Type'};
    colnum=2;
    columnwidth=120;
    position=[493 157 220 130];
    handles.table1=uitable_damla(handles.figure1,colnum,columnwidth,position,colnames,data);

% updating data or column names or visibility from callback fcns
handles.table1.setData(new_data);
handles.table1.setColumnNames(new_colnames);
handles.table1.setVisible('on');

---------------------------------------------------------------------------------------------------------------
Hope this helps someone. Not pretty, but this was the only option worked for me.
 

Tags for this Thread

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.

Contact us