Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Data grid in GUI (Linux)
Hello,

I need to display the user data in the GUI, using some kind of table
(data grid). I don't need the editing ability - all I need is to
display them.

As far as I know there's no such UI element in the Matlab itself, and
here I've found only some ActiveX controls, but I'm working on Linux,
so it's useless for me. Is there some way to display a simple table?

Thanks a lot in advance.

Tomas

Report this thread to moderator Post Follow-up to this message
Old Post
Tomas Vondra
04-28-05 02:01 AM


Re: Data grid in GUI (Linux)
Tomas Vondra wrote:
> Hello,
>
> I need to display the user data in the GUI, using some kind of table
> (data grid). I don't need the editing ability - all I need is to
> display them.
>
> As far as I know there's no such UI element in the Matlab itself, and
> here I've found only some ActiveX controls, but I'm working on Linux,
> so it's useless for me. Is there some way to display a simple table?
>
> Thanks a lot in advance.
>
> Tomas

If you have R14 ( sp2 ?? ) there is the command uitable. Do

help uitable


Report this thread to moderator Post Follow-up to this message
Old Post
Brad Phelan
04-28-05 02:00 PM


Re: Data grid in GUI (Linux)
>>Tomas
>
>
> If you have R14 ( sp2 ?? ) there is the command uitable. Do
>
> help uitable
>
I've had a little play with the object and I'm not too sure how usable
it is. Here is an example of it's use but it's a bit fiddly.

function out = use_table

data = rand(3);
colnames = {'X-Data', 'Y-Data', 'Z-Data'};
t = uitable(data, colnames,'Position', [20 20 250 100]);

t.DataChangedCallback = @change_fcn;

out = @get_data;

function out = get_data
out = data;
end

function change_fcn(src, ev)
row = ev.getEvent.getFirstRow;
col = ev.getEvent.getColumn;
d = src.TableModel.getValueAt(row,col);
data(row+1,col+1) = str2num(d);
end


end

The trick to make this more usable would be to create some
implementation of javax.swing.TableModel that has a friendly matlab back
end such like so that you can do the following somehow.

function use_table

data = rand(10);

% Create a uitable with a simple matlab data model. Specify
% that the cell class will be all of double.
t = uitable(@getfun, @setfun, 'double');

function val = getfun(t, row, col)
val = data(row,col);
end

function setfun(t, row, col, val)
data(row,col) = val;
end

end

Report this thread to moderator Post Follow-up to this message
Old Post
Brad Phelan
04-28-05 02:00 PM


Re: Data grid in GUI (Linux)
Wasn't as hard as I thought ....

http://xtargets.com/cms/Tutorials/M...GUI-Tables.html

You use the little tool detailed on the website as below

function use_table

data = rand(4);

% Create a uitable with a simple matlab data model. Specify
% that the conversion class will be %g.
t = xtargets_uitable(4,4, @getfun, @setfun, '%g');

function val = getfun( row, col)
val = data(row,col);
end

function setfun( row, col, val)
data(row,col) = val;
end

end


Report this thread to moderator Post Follow-up to this message
Old Post
Brad Phelan
04-28-05 02:00 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Matlab archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.